sentry.server.config.ts35 lines · main
1// This file configures the initialization of Sentry on the server.
2// The config you add here will be used whenever the server handles a request.
3// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4
5import * as Sentry from '@sentry/nextjs'
6
7Sentry.init({
8 dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
9 ...(process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT && {
10 environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
11 }),
12 // Setting this option to true will print useful information to the console while you're setting up Sentry.
13 debug: false,
14
15 // Enable performance monitoring
16 tracesSampleRate: 0.02,
17 ignoreErrors: [
18 'ResizeObserver',
19 'Failed to load Stripe.js',
20 // Next.js internals — not actual errors
21 'NEXT_NOT_FOUND',
22 'NEXT_REDIRECT',
23 // Network / infrastructure
24 /504 Gateway Time-out/,
25 'Network request failed',
26 'Failed to fetch',
27 'AbortError',
28 // Code-split loading failures
29 'ChunkLoadError',
30 /Loading chunk [\d]+ failed/,
31 // React hydration mismatches caused by extensions modifying DOM before hydration
32 /text content does not match/i,
33 /There was an error while hydrating/i,
34 ],
35})