-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Remove client.(server|client).config.ts
functionality in favor of instrumentation.ts
#11059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(nextjs): Remove client.(server|client).config.ts
functionality in favor of instrumentation.ts
#11059
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ccf4f85
feat(nextjs): Allow omitting `client.(server|client).config.ts` and n…
68df8ea
.
d5dacb9
comment
1f04110
fix unit tests
2bd96d3
Update withSentryConfig
b4defba
.
39eeef8
remove unneeded stuff
5b8aab0
Remove unnecessary test
352aea5
feat(nextjs): Bump minimum required Next.js version to `13.2.0`
2638403
.
858f7d3
hm
39a3622
fix
f7686c2
Merge branch 'develop' into lforst-nextjs-instrumentts
f55d122
lint
09d7011
Merge branch 'lforst-min-nextjs-version' into lforst-nextjs-instrumentts
a8966a6
migrate
de7a1a9
fix
ccddc92
Merge branch 'develop' into lforst-min-nextjs-version
9aad6a4
Merge branch 'develop' into lforst-nextjs-instrumentts
9a8ed80
.
6bfbfbb
test
6a89e31
.
55103c8
Merge remote-tracking branch 'origin/develop' into lforst-min-nextjs-…
2e2f00b
Merge branch 'lforst-min-nextjs-version' into lforst-nextjs-instrumentts
51a5612
Merge remote-tracking branch 'origin/develop' into lforst-nextjs-inst…
7adf28f
.
864defc
hell yea
d7c8669
.
e48c81d
.
752580f
fix tests
0079726
Merge branch 'develop' into lforst-nextjs-instrumentts
9e4b8f3
undeactivate tests
f169bea
Update readme
5e2f44c
Be more clear that sentry.client.config.ts is still supported
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
dev-packages/e2e-tests/test-applications/create-next-app/instrumentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
declare global { | ||
namespace globalThis { | ||
var transactionIds: string[]; | ||
} | ||
} | ||
|
||
export function register() { | ||
if (process.env.NEXT_RUNTIME === 'nodejs') { | ||
Sentry.init({ | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, | ||
// Adjust this value in production, or use tracesSampler for greater control | ||
tracesSampleRate: 1.0, | ||
integrations: [Sentry.localVariablesIntegration()], | ||
}); | ||
|
||
Sentry.addEventProcessor(event => { | ||
global.transactionIds = global.transactionIds || []; | ||
|
||
if (event.type === 'transaction') { | ||
const eventId = event.event_id; | ||
|
||
if (eventId) { | ||
global.transactionIds.push(eventId); | ||
} | ||
} | ||
|
||
return event; | ||
}); | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
dev-packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
dev-packages/e2e-tests/test-applications/nextjs-14/instrumentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
export function register() { | ||
if (process.env.NEXT_RUNTIME === 'nodejs' || process.env.NEXT_RUNTIME === 'edge') { | ||
Sentry.init({ | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, | ||
tunnel: `http://localhost:3031/`, // proxy server | ||
tracesSampleRate: 1.0, | ||
sendDefaultPii: true, | ||
}); | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
dev-packages/e2e-tests/test-applications/nextjs-14/sentry.edge.config.ts
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
dev-packages/e2e-tests/test-applications/nextjs-14/sentry.server.config.ts
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
dev-packages/e2e-tests/test-applications/nextjs-app-dir/instrumentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
export function register() { | ||
if (process.env.NEXT_RUNTIME === 'nodejs' || process.env.NEXT_RUNTIME === 'edge') { | ||
Sentry.init({ | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, | ||
tunnel: `http://localhost:3031/`, // proxy server | ||
tracesSampleRate: 1.0, | ||
sendDefaultPii: true, | ||
}); | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
dev-packages/e2e-tests/test-applications/nextjs-app-dir/sentry.edge.config.ts
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
dev-packages/e2e-tests/test-applications/nextjs-app-dir/sentry.server.config.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This begs a question: Suppose I have the same config for node and edge (as in this example). Do I even need the
if
statement? Asking because I guess this is a common thing for users and if it's indeed necessary, we should point that out.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more to be in line with what the Next.js docs say and to be forwards compatible. Let's say Next.js also starts running the register hook on the browser, not having the if statement would horribly fail in some cases.