-
Notifications
You must be signed in to change notification settings - Fork 3
TH-1465, HH-481, LIIKUNTA-780 : migrate apps to Next.js instrumentation and align Sentry v10 config #1070
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
TH-1465, HH-481, LIIKUNTA-780 : migrate apps to Next.js instrumentation and align Sentry v10 config #1070
Changes from all commits
Commits
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,4 +41,6 @@ report | |
|
|
||
| .vscode/ | ||
|
|
||
| certificates | ||
| certificates | ||
| # Sentry Config File | ||
| .env.sentry-build-plugin | ||
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| // This file configures the initialization of Sentry on the server. | ||
| // The config you add here will be used whenever the server handles a request. | ||
| // https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
|
||
| import { | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| } from '@events-helsinki/components/sentry/utils'; | ||
| import * as Sentry from '@sentry/nextjs'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
| environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
| // Adjust this value in production, or use tracesSampler for greater control | ||
| // @see https://develop.sentry.dev/sdk/performance/ | ||
| // To turn it off, remove the line | ||
| // @see https://github.com/getsentry/sentry-javascript/discussions/4503#discussioncomment-2143116 | ||
| tracesSampleRate: parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_TRACE_SAMPLE_RATE ?? '0.1' | ||
| ), | ||
| // ... | ||
| // Note: if you want to override the automatic release value, do not set a | ||
| // `release` value here - use the environment variable `SENTRY_RELEASE`, so | ||
| // that it will also get attached to your source maps | ||
| beforeSend: async (event, hint) => { | ||
| if (process.env.NODE_ENV === 'development') { | ||
| // eslint-disable-next-line no-console | ||
| console.log('Sentry event', event); | ||
| // eslint-disable-next-line no-console | ||
| console.log('Sentry hint', hint); | ||
| } | ||
| return event; | ||
| }, | ||
| }); | ||
| if (process.env.NEXT_PUBLIC_SENTRY_DSN) { | ||
| Sentry.init({ | ||
| dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
| environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
| release: process.env.NEXT_PUBLIC_SENTRY_RELEASE, | ||
| // Adjust this value in production, or use tracesSampler for greater control | ||
| // @see https://develop.sentry.dev/sdk/performance/ | ||
| // To turn it off, remove the line | ||
| // @see https://github.com/getsentry/sentry-javascript/discussions/4503#discussioncomment-2143116 | ||
| tracesSampleRate: Number.parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE || '0' | ||
| ), | ||
| normalizeDepth: 3, | ||
| integrations: [Sentry.extraErrorDataIntegration({ depth: 3 })], | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| // Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
| debug: false, | ||
| }); | ||
| } |
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 |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| // This file configures the initialization of Sentry on the server. | ||
| // The config you add here will be used whenever the server handles a request. | ||
| // https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
|
||
| import { | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| } from '@events-helsinki/components/sentry/utils'; | ||
| import * as Sentry from '@sentry/nextjs'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
| environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
| // Adjust this value in production, or use tracesSampler for greater control | ||
| // @see https://develop.sentry.dev/sdk/performance/ | ||
| // To turn it off, remove the line | ||
| // @see https://github.com/getsentry/sentry-javascript/discussions/4503#discussioncomment-2143116 | ||
| tracesSampleRate: parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_TRACE_SAMPLE_RATE ?? '0.1' | ||
| ), | ||
| // ... | ||
| // Note: if you want to override the automatic release value, do not set a | ||
| // `release` value here - use the environment variable `SENTRY_RELEASE`, so | ||
| // that it will also get attached to your source maps | ||
| beforeSend: async (event, hint) => { | ||
| if (process.env.NODE_ENV === 'development') { | ||
| // eslint-disable-next-line no-console | ||
| console.log('Sentry event', event); | ||
| // eslint-disable-next-line no-console | ||
| console.log('Sentry hint', hint); | ||
| } | ||
| return event; | ||
| }, | ||
| }); | ||
| if (process.env.NEXT_PUBLIC_SENTRY_DSN) { | ||
| Sentry.init({ | ||
| dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
| environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
| release: process.env.NEXT_PUBLIC_SENTRY_RELEASE, | ||
| // Adjust this value in production, or use tracesSampler for greater control | ||
| // @see https://develop.sentry.dev/sdk/performance/ | ||
| // To turn it off, remove the line | ||
| // @see https://github.com/getsentry/sentry-javascript/discussions/4503#discussioncomment-2143116 | ||
| tracesSampleRate: Number.parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE || '0' | ||
| ), | ||
| normalizeDepth: 3, | ||
| integrations: [Sentry.extraErrorDataIntegration({ depth: 3 })], | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| // Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
| debug: false, | ||
| }); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // This file configures the initialization of Sentry on the client. | ||
| // The added config here will be used whenever a users loads a page in their browser. | ||
| // https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
|
||
| import { | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| } from '@events-helsinki/components/sentry/utils'; | ||
| import type { IntegrationFn } from '@sentry/core'; | ||
| import { thirdPartyErrorFilterIntegration } from '@sentry/core'; | ||
| import * as Sentry from '@sentry/nextjs'; | ||
| import { | ||
| captureRouterTransitionStart, | ||
| replayIntegration, | ||
| } from '@sentry/nextjs'; | ||
|
|
||
| if (process.env.NEXT_PUBLIC_SENTRY_DSN) { | ||
| Sentry.init({ | ||
| beforeSend, | ||
| beforeSendTransaction, | ||
| normalizeDepth: 3, | ||
| integrations: [ | ||
| replayIntegration(), | ||
| Sentry.extraErrorDataIntegration({ depth: 3 }), | ||
| thirdPartyErrorFilterIntegration({ | ||
| filterKeys: process.env.NEXT_PUBLIC_SENTRY_PROJECT | ||
| ? [process.env.NEXT_PUBLIC_SENTRY_PROJECT] | ||
| : [], | ||
| behaviour: 'drop-error-if-contains-third-party-frames', | ||
| }) as IntegrationFn, | ||
| ], | ||
| dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
| environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
| release: process.env.NEXT_PUBLIC_SENTRY_RELEASE, | ||
| ignoreErrors: [ | ||
| 'ResizeObserver loop completed with undelivered notifications', | ||
| 'ResizeObserver loop limit exceeded', | ||
| ], | ||
| tracesSampleRate: Number.parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE || '0' | ||
| ), | ||
| tracePropagationTargets: process.env | ||
| .NEXT_PUBLIC_SENTRY_TRACE_PROPAGATION_TARGETS | ||
| ? process.env.NEXT_PUBLIC_SENTRY_TRACE_PROPAGATION_TARGETS.split(',') | ||
| : [], | ||
| replaysSessionSampleRate: Number.parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE || '0' | ||
| ), | ||
| replaysOnErrorSampleRate: Number.parseFloat( | ||
| process.env.NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE || '0' | ||
| ), | ||
| debug: false, | ||
| }); | ||
| } | ||
|
|
||
| export const onRouterTransitionStart = captureRouterTransitionStart; | ||
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 async function register() { | ||
| if (process.env.NEXT_RUNTIME === 'nodejs') { | ||
| await import('../sentry.server.config'); | ||
| } | ||
|
|
||
| if (process.env.NEXT_RUNTIME === 'edge') { | ||
| await import('../sentry.edge.config'); | ||
| } | ||
| } | ||
|
|
||
| export const onRequestError = Sentry.captureRequestError; |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.