Title: `_experimental.turbopackApplicationKey` breaks React useEffect during SSR prerendering (Next.js 16 + Turbopack) · Issue #20101 · getsentry/sentry-javascript · GitHub
Open Graph Title: `_experimental.turbopackApplicationKey` breaks React useEffect during SSR prerendering (Next.js 16 + Turbopack) · Issue #20101 · getsentry/sentry-javascript
X Title: `_experimental.turbopackApplicationKey` breaks React useEffect during SSR prerendering (Next.js 16 + Turbopack) · Issue #20101 · 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/20101
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_experimental.turbopackApplicationKey` breaks React useEffect during SSR prerendering (Next.js 16 + Turbopack)","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues [https://github.com/getsentry/sentry-javascript/issues](\u003chttps://github.com/getsentry/sentry-javascript/issues>)\n- [X] I have reviewed the documentation [https://docs.sentry.io/](\u003chttps://docs.sentry.io/>)\n- [X] I am using the latest SDK release [https://github.com/getsentry/sentry-javascript/releases](\u003chttps://github.com/getsentry/sentry-javascript/releases>)\n\n### How do you use Sentry?\n\nSentry Saas ([sentry.io](\u003chttp://sentry.io>))\n\n### Which SDK are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n10.47.0\n\n### Framework Version\n\nNext.js 16.2.2\n\n### Link to Sentry event\n\n*No response*\n\n### Reproduction Example/SDK Setup\n\nMinimal reproduction:\u003cbr>[https://github.com/igz0/sentry-nextjs-turbopack-gtm-repro](\u003chttps://github.com/igz0/sentry-nextjs-turbopack-gtm-repro>)\n\n```ts\n// next.config.ts\nimport { withSentryConfig } from '@sentry/nextjs';\nimport type { NextConfig } from 'next';\n\nconst nextConfig: NextConfig = {};\n\nexport default withSentryConfig(nextConfig, {\n org: 'my-org',\n project: 'my-project',\n silent: true,\n _experimental: {\n turbopackApplicationKey: 'my-app',\n },\n});\n```\n\n```ts\n// sentry.client.config.ts\nimport * as Sentry from '@sentry/nextjs';\n\nSentry.init({\n dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',\n integrations: [\n Sentry.thirdPartyErrorFilterIntegration({\n filterKeys: ['my-app'],\n behaviour: 'drop-error-if-contains-third-party-frames',\n }),\n ],\n});\n```\n\n```ts\n// instrumentation-client.ts\nimport * as Sentry from '@sentry/nextjs';\nimport './sentry.client.config';\n\nexport const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\n```\n\n```tsx\n// app/layout.tsx\nimport { GoogleTagManager } from '@next/third-parties/google';\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n \u003chtml lang=\"en\">\n \u003cbody>\n \u003cGoogleTagManager gtmId=\"GTM-XXXXXX\" />\n {children}\n \u003c/body>\n \u003c/html>\n );\n}\n```\n\n### Steps to Reproduce\n\n1. Create a Next.js 16 app with Turbopack\n2. Install `@sentry/nextjs@10.47.0` and `@next/third-parties@16.2.2`\n3. Enable `_experimental.turbopackApplicationKey` in `withSentryConfig`\n4. Configure `thirdPartyErrorFilterIntegration`\n5. Render `GoogleTagManager` from `@next/third-parties/google` in `app/layout.tsx`\n6. Run `npm run build`\n\n### Expected Result\n\nBuild completes successfully.\n\n`thirdPartyErrorFilterIntegration` should work with Turbopack without breaking SSR prerendering.\n\n### Actual Result\n\nBuild fails during prerendering of `/_not-found` with:\n\n```text\nError occurred prerendering page \"/_not-found\". Read more: https://nextjs.org/docs/messages/prerender-error\nTypeError: (0 , g.useEffect) is not a function\n at c.GoogleTagManager (.next/server/chunks/ssr/_0u36dvt._.js:2:9947)\nExport encountered an error on /_not-found/page: /_not-found, exiting the build.\n⨯ Next.js build worker exited with code: 1 and signal: null\n```\n\nIf I remove only this block from `next.config.ts`, the build succeeds again:\n\n```ts\n_experimental: {\n turbopackApplicationKey: 'my-app',\n},\n```\n\n### Additional Context\n\nThis seems related to the Turbopack support added for `thirdPartyErrorFilterIntegration` in [JS-1710](https://linear.app/getsentry/issue/JS-1710/nextjs-turbopack-thirdpartyerrorfilterintegration-applicationkey) / [#19542](\u003chttps://github.com/getsentry/sentry-javascript/issues/19542>).\n\nI understand there was follow-up discussion in [JS-1710](https://linear.app/getsentry/issue/JS-1710/nextjs-turbopack-thirdpartyerrorfilterintegration-applicationkey) about aligning behavior with webpack by treating `node_modules` as first-party. However, with the current distributed implementation in `@sentry/nextjs@10.47.0`, enabling `_experimental.turbopackApplicationKey` appears to break SSR prerendering when `GoogleTagManager` from `@next/third-parties/google` is present.\n\nIn other words:\n\n* `_experimental.turbopackApplicationKey` enabled: build fails\n* `_experimental.turbopackApplicationKey` removed: build succeeds\n\nEnvironment:\n\n* `@sentry/nextjs`: 10.47.0\n* `next`: 16.2.2\n* `react`: 19.2.4\n* `@next/third-parties`: 16.2.2","author":{"url":"https://github.com/igz0","@type":"Person","name":"igz0"},"datePublished":"2026-04-04T02:59:44Z","url":"https://github.com/getsentry/sentry-javascript/issues/20101"}
| 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:2314b529-65b6-1455-331f-de1418828cb2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAB6:232DFC:2853D1A:34CBDA0:6B042C50 |
| html-safe-nonce | c046d3e4b2dc132e0d16be61b759f7c11b602ca063daf0a0e17bca934d6737c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUI2OjIzMkRGQzoyODUzRDFBOjM0Q0JEQTA6NkIwNDJDNTAiLCJ2aXNpdG9yX2lkIjoiOTAwMTA4Nzg2MTY3MTYwMzI4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2eb83d357836066f7b8b2a6a872fca6e5b5996c3cb9d30e12b3a6775e9a4720a |
| hovercard-subject-tag | issue:4203163882 |
| 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/20101/issue_layout |
| twitter:image | https://opengraph.githubassets.com/108105bb320c62abf22665c1170337e29da13dfd4719d796a13995531986bc30/getsentry/sentry-javascript/issues/20101 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/108105bb320c62abf22665c1170337e29da13dfd4719d796a13995531986bc30/getsentry/sentry-javascript/issues/20101 |
| 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 | igz0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| 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