-
-
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…
lforst 68df8ea
.
lforst d5dacb9
comment
lforst 1f04110
fix unit tests
lforst 2bd96d3
Update withSentryConfig
lforst b4defba
.
lforst 39eeef8
remove unneeded stuff
lforst 5b8aab0
Remove unnecessary test
lforst 352aea5
feat(nextjs): Bump minimum required Next.js version to `13.2.0`
lforst 2638403
.
lforst 858f7d3
hm
lforst 39a3622
fix
lforst f7686c2
Merge branch 'develop' into lforst-nextjs-instrumentts
lforst f55d122
lint
lforst 09d7011
Merge branch 'lforst-min-nextjs-version' into lforst-nextjs-instrumentts
lforst a8966a6
migrate
lforst de7a1a9
fix
lforst ccddc92
Merge branch 'develop' into lforst-min-nextjs-version
lforst 9aad6a4
Merge branch 'develop' into lforst-nextjs-instrumentts
lforst 9a8ed80
.
lforst 6bfbfbb
test
lforst 6a89e31
.
lforst 55103c8
Merge remote-tracking branch 'origin/develop' into lforst-min-nextjs-…
lforst 2e2f00b
Merge branch 'lforst-min-nextjs-version' into lforst-nextjs-instrumentts
lforst 51a5612
Merge remote-tracking branch 'origin/develop' into lforst-nextjs-inst…
lforst 7adf28f
.
lforst 864defc
hell yea
lforst d7c8669
.
lforst e48c81d
.
lforst 752580f
fix tests
lforst 0079726
Merge branch 'develop' into lforst-nextjs-instrumentts
lforst 9e4b8f3
undeactivate tests
lforst f169bea
Update readme
lforst 5e2f44c
Be more clear that sentry.client.config.ts is still supported
lforst 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.