Title: nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts · Issue #25544 · getsentry/sentry-javascript · GitHub
Open Graph Title: nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts · Issue #25544 · getsentry/sentry-javascript
X Title: nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts · Issue #25544 · 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/25544
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts","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/browser\n\n### SDK Version\n\n10.64.0 (the same rule ships in 11.8.0 and on develop)\n\n### Framework Version\n\n16.4.0\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n```ts\n// next.config.ts\nexport default withSentryConfig(nextConfig, {\n applicationKey: \"my-app\",\n})\n\n// instrumentation-client.ts\nSentry.init({\n dsn: \"...\",\n integrations: [\n Sentry.thirdPartyErrorFilterIntegration({\n filterKeys: [\"my-app\"],\n behaviour: \"apply-tag-if-exclusively-contains-third-party-frames\",\n }),\n ],\n})\n```\n\n### Steps to Reproduce\n\n1. Set `applicationKey` in `withSentryConfig` on a Next 16 app that builds with Turbopack.\n2. Run `next build`.\n3. Search the output for `_sentryBundlerPluginAppKey:my-app` in `.next/static` and in `.next/server`.\n4. Start `next start` and time the first request to a route on a fresh process.\n\n### Expected Result\n\nOnly browser modules carry the metadata snippet. `thirdPartyErrorFilterIntegration` only runs in the browser, and `@sentry/node` does not export it, so nothing on the server reads the tags.\n\n\n### Actual Result\n\n`constructTurbopackConfig` adds a `*.{ts,tsx,js,jsx,mjs,cjs}` rule whose only condition is `{ not: { path: /next\\/dist\\/build\\/polyfills/ } }`. Turbopack applies it to server and edge modules too. Each snippet evaluates `new Error().stack` twice when its module loads, so every cold start pays for it.\n\nIn our app:\n\n| | Default rule | Same rule with a `\"browser\"` condition |\n| --- | ---: | ---: |\n| Snippets in server output | 15,353 | 5 |\n| Snippets in browser output | 4,840 | 4,840 |\n| Cold first request, `next start` on a laptop, median of 7 (three routes) | 757 / 816 / 829 ms | 650 / 697 / 786 ms |\n| Cold first request, Vercel preview (1 vCPU) | ~2.7 s | ~2.15 s |\n\nOn Vercel's slower CPU the snippets cost 0.4 to 0.5 s per cold start. \n\n### Additional Context\n\nSuggested fix, in `constructTurbopackConfig`:\n\n```js\ncondition: { all: [\"browser\", { not: { path: /next\\/dist\\/build\\/polyfills/ } }] },\n```\n\nWe ran exactly this as our own `turbopack.rules` entry pointing at `build/cjs/config/loaders/moduleMetadataInjectionLoader.js`. The browser output was unchanged. \n\n\nRelated: #19320 (Turbopack `applicationKey` support), #23402 (same loader, for `moduleMetadata`), #14041.\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/JasonLovesDoggo","@type":"Person","name":"JasonLovesDoggo"},"datePublished":"2026-10-19T20:29:46Z","url":"https://github.com/getsentry/sentry-javascript/issues/25544"}
| 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:ebe7cffd-07c6-242b-b06b-43ceec081153 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9074:102FBB:21F080E:2C66BE3:6B04159D |
| html-safe-nonce | 5c2d8da2a089d9a0c718b2f9a3c1d111ba083e7bff4ef7e2a8cc0f602229ab19 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDc0OjEwMkZCQjoyMUYwODBFOjJDNjZCRTM6NkIwNDE1OUQiLCJ2aXNpdG9yX2lkIjoiNzczMzAxNDQ4MjgxMjkzMzUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e2e26e35fd92cc9f8a69be07e398de2e6ef4ac026c6e4cbd3e19d8f7da8b0ebc |
| hovercard-subject-tag | issue:5931054218 |
| 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/25544/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f061011abdb98804fc4320138627ca719f1837e278ae29e9790ca2f1dcf7bfa/getsentry/sentry-javascript/issues/25544 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f061011abdb98804fc4320138627ca719f1837e278ae29e9790ca2f1dcf7bfa/getsentry/sentry-javascript/issues/25544 |
| 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 | JasonLovesDoggo |
| 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