Title: [NextJS] Local env becomes slow after adding Sentry · Issue #18523 · getsentry/sentry-javascript · GitHub
Open Graph Title: [NextJS] Local env becomes slow after adding Sentry · Issue #18523 · getsentry/sentry-javascript
X Title: [NextJS] Local env becomes slow after adding Sentry · Issue #18523 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/18523
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[NextJS] Local env becomes slow after adding Sentry","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n\"@sentry/nextjs\": \"^10.29.0\",\n\n### Framework Version\n\n\"next\": \"^15.5.7\",\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\nMonolithic application and we use next.js.\n\nDev environment. For compilation, we just use npm run build of next.js where it runs next build. But for development, we use npm run dev that runs next dev --experimental-https\nFor our sentry.server.config.ts, we use this code:\n\n```ts\n// This file configures the initialization of Sentry on the server.\n// The config you add here will be used whenever the server handles a request.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\nimport { init } from \"@sentry/nextjs\";\n\nconst isProduction = process.env.NODE_ENV === \"production\";\n\n// Use environment-specific DSN if available, otherwise fall back to default\nconst sentryDsn =\n process.env.SENTRY_DSN ||\n \"DSN_HERE\";\n\ninit({\n dsn: sentryDsn,\n\n // Set the environment\n environment: process.env.NODE_ENV || \"development\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: isProduction ? 0.1 : 1, // Lower sampling in production\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: !isProduction,\n\n // Add release information\n release: process.env.VERCEL_GIT_COMMIT_SHA || \"development\",\n\n // Add tags for better filtering\n initialScope: {\n tags: {\n environment: process.env.NODE_ENV || \"development\",\n deployment: process.env.VERCEL_ENV || \"local\",\n },\n },\n\n // Only enable Sentry in production or when explicitly enabled\n enabled: isProduction || process.env.ENABLE_SENTRY === \"true\",\n});\n\n```\nwe also capture all thrown exception with our global-error.ts\n```ts\n\"use client\";\n\nimport { captureException } from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({\n error,\n}: {\n error: Error & { digest?: string };\n}) {\n useEffect(() => {\n captureException(error);\n }, [error]);\n\n return (\n \u003chtml>\n \u003cbody>\n {/* `NextError` is the default Next.js error page component. Its type\ndefinition requires a `statusCode` prop. However, since the App Router\ndoes not expose status codes for errors, we simply pass 0 to render a\ngeneric error message. */}\n \u003cNextError statusCode={0} />\n \u003c/body>\n \u003c/html>\n );\n}\n\n```\n\n### Steps to Reproduce\n\nSee above\n\n### Expected Result\n\nCompilation time is about 2 seconds.\n\n### Actual Result\n\nwe identified our local environment was very slow due to the fact that we had to compile thousands of modules every time we do load a page. We identfied that removing sentry from our code base was speeding up significantly. The difference between the attached files is we had once sentry installed and once sentry completely removed from the code base. Using environment variables didn't help here.\n\nWithout Sentry:\n\n\u003cimg width=\"704\" height=\"212\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/bdd3ec71-2bca-4f27-9625-0e486cf21fbd\" />\n\nWith Sentry:\n\n\u003cimg width=\"710\" height=\"193\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/4044991d-8b75-4a1a-97fc-ac4d59b8c631\" />\n\n### Additional Context\n\nThis is an escalation from Zendesk for the customer. Original ticket and their `package.json` are provided in the connected Linear issue.\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/InterstellarStella","@type":"Person","name":"InterstellarStella"},"datePublished":"2025-12-16T10:58:34Z","url":"https://github.com/getsentry/sentry-javascript/issues/18523"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:159fa60b-6f6b-3e29-94ee-57817e0c0bde |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3C8:274E3B:3692F0:48C4E8:6B03CD5E |
| html-safe-nonce | 052fcc3931a7b89d7825eb8b183db24571cc19198c59012d9fc2bc106653610d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0M4OjI3NEUzQjozNjkyRjA6NDhDNEU4OjZCMDNDRDVFIiwidmlzaXRvcl9pZCI6IjE5NDMyMTA4OTA2MTg5ODE3MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cdaec2ad793e44e7f188759f557d86ce312a84c300b87b6ac758c2ec6db1630c |
| hovercard-subject-tag | issue:3734282578 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/18523/issue_layout |
| twitter:image | https://opengraph.githubassets.com/316da9978e5e8bbd30c0144d619e16ae1ba18d44df0a00168e49a150cce26af4/getsentry/sentry-javascript/issues/18523 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/316da9978e5e8bbd30c0144d619e16ae1ba18d44df0a00168e49a150cce26af4/getsentry/sentry-javascript/issues/18523 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | InterstellarStella |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width