Title: @sentry/nextjs server entry re-exports withSentryConfig, pulling the orchestrion webpack plugin's WASM into the runtime bundle (CompileError on Cloudflare Workers) · Issue #22794 · getsentry/sentry-javascript · GitHub
Open Graph Title: @sentry/nextjs server entry re-exports withSentryConfig, pulling the orchestrion webpack plugin's WASM into the runtime bundle (CompileError on Cloudflare Workers) · Issue #22794 · getsentry/sentry-javascript
X Title: @sentry/nextjs server entry re-exports withSentryConfig, pulling the orchestrion webpack plugin's WASM into the runtime bundle (CompileError on Cloudflare Workers) · Issue #22794 · 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/22794
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@sentry/nextjs server entry re-exports withSentryConfig, pulling the orchestrion webpack plugin's WASM into the runtime bundle (CompileError on Cloudflare Workers)","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.68.0\n\n### Framework Version\n\nNext.js 16.2.11, @opennextjs/cloudflare 1.20.2, node 26.2.0, workerd compatibility_date 2026-04-14\n\n### Link to Sentry event\n\n*Private project — full stack and tags reproduced below.*\n\n### Reproduction Example/SDK Setup\n\nA Next.js app deployed to Cloudflare Workers via OpenNext, with the standard \u003cbr>`instrumentation.ts` setup:\n\n```ts\n// src/instrumentation.ts\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"../sentry.server.config\");\n }\n}\n```\n\n### Steps to Reproduce\n\n1. `import * as Sentry from \"@sentry/nextjs\"` from any **server** module (`instrumentation.ts`, `sentry.server.config.ts`, a route handler).\n2. Build for Cloudflare Workers (`opennextjs-cloudflare build`) and deploy.\n3. Trigger a cold start — any request will do.\n\n### Expected Result\n\nThe runtime bundle contains only runtime code. Nothing attempts \u003cbr>`WebAssembly.compile()` at module-evaluation time, since Cloudflare Workers \u003cbr>forbids runtime WASM compilation.\n\n### Actual Result\n\nEvery cold start raises an unhandled promise rejection:\n\n```\nCompileError: WebAssembly.compile(): Wasm code generation disallowed by embedder\n at Context.commonJsRequire\n at getOrInstantiateModuleFromParent\n at instantiateModule\n at module evaluation\n```\n\nTagged `unhandledPromiseRejection: true`, with no route frames — the stack is \u003cbr>module evaluation only. In our project this produced 50 events over four days, \u003cbr>one per cold start, attributed to whichever request happened to warm the \u003cbr>isolate (44 of 50 have an empty `transaction` tag).\n\n### Root cause\n\n`@sentry/nextjs`'s **server runtime entry** re-exports the build-time config \u003cbr>helper, and that export's module graph reaches a bundler plugin containing an \u003cbr>inlined WASM module:\n\n```\nnode_modules/@sentry/nextjs/build/esm/index.server.js:1\n export { withSentryConfig } from './config/withSentryConfig/index.js';\n -> config/withSentryConfig/buildTime.js:4,6\n import { getTracingHooksDirectory } from '@sentry/server-utils/orchestrion/webpack';\n import { sentryOrchestrionWebpackPlugin } from '@sentry/server-utils/orchestrion/webpack';\n -> @sentry/server-utils/build/esm/orchestrion/bundler/webpack.js\n -> @apm-js-collab/code-transformer-bundler-plugins@0.7.1\n```\n\nThe plugin compiles an inlined base64 WASM module (a CJS/ESM lexer) at **module**** \u003cbr>****scope**, unawaited:\n\n```js\ng = WebAssembly.compile(d()).then(WebAssembly.instantiate).then(({exports: e}) => { u = e })\n```\n\nOn Node that promise resolves and nobody notices. On Workers `WebAssembly.compile` \u003cbr>throws, and because the promise is never awaited it surfaces as an unhandled \u003cbr>rejection during module evaluation — with a stack that names no application code, \u003cbr>which makes it quite hard to attribute.\n\n`@sentry/cloudflare` is not the culprit: `build/esm/sdk.js:33-39` explicitly reads \u003cbr>channel integrations off a global marker rather than importing them, with a comment \u003cbr>saying this is \"so bundles built without the plugin don't ship the code.\" That part \u003cbr>works as designed. The leak is the Next.js server entry.\n\n### What I verified\n\n* The only dependency path to the plugin is `@sentry/cloudflare -> @sentry/server-utils -> @apm-js-collab/code-transformer-bundler-plugins@0.7.1`, but the *inclusion* comes from the import chain above.\n* `.next/server` contains the plugin in 12 chunks, including the base64 WASM blob.\n* **Control build:** removing `withSentryConfig` from `next.config.ts` entirely and rebuilding leaves all 12 chunks unchanged. The build-time config file is not what pulls it in — importing `@sentry/nextjs` from a server module is.\n* `@sentry/server-utils`' main entry does *not* reach the plugin (it is confined to the `./orchestrion/*` subpath exports), and the `./orchestrion` barrel re-exports only channel integrations. So the subpath import in `buildTime.js` is the single crossing point.\n\n### Why this may matter beyond Workers\n\ngetsentry/sentry-javascript#22632 states the design assumption directly: \"orchestrion only ships via \u003cbr>`@sentry/node/{vite,webpack,rollup,esbuild}` and framework server builds.\" That \u003cbr>assumption doesn't hold here — `withSentryConfig` sitting on `index.server.js` \u003cbr>puts the webpack plugin one `import * as Sentry from \"@sentry/nextjs\"` away from \u003cbr>any server bundle. Cloudflare Workers just makes it *loud*, because runtime WASM \u003cbr>compilation is a hard error there. Elsewhere it is silent bundle weight.\n\n### Suggested fix\n\nMove `withSentryConfig` off the runtime server entry, or make \u003cbr>`config/withSentryConfig/buildTime.js` import the bundler plugin lazily \u003cbr>(`await import(...)` inside the function that uses it) so the WASM module isn't \u003cbr>reachable from module-evaluation of the runtime entry.\n\n### Workaround for others hitting this\n\nAlias `@sentry/server-utils/orchestrion/*` to an empty module in the Worker build, \u003cbr>or import the runtime pieces from `@sentry/cloudflare` instead of `@sentry/nextjs` \u003cbr>where possible.","author":{"url":"https://github.com/isaacrowntree","@type":"Person","name":"isaacrowntree"},"datePublished":"2026-07-29T02:11:33Z","url":"https://github.com/getsentry/sentry-javascript/issues/22794"}
| 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:0ffcf218-6ce3-d4fb-ec80-fa2c6831678e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C760:33098E:1C1B2E9:250EED4:6B0412AE |
| html-safe-nonce | 3d6aeb63b15c8d86bba757f2123b69dad37a137cadd0cae15794f0cf957bea50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzYwOjMzMDk4RToxQzFCMkU5OjI1MEVFRDQ6NkIwNDEyQUUiLCJ2aXNpdG9yX2lkIjoiMzc3MjIxODY2MzQ2NjQzOTM0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dea5547a93adf2eabe2cf75ce060c858db61bcea1262c6fbac257d4f567a3c24 |
| hovercard-subject-tag | issue:5004692116 |
| 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/22794/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc5d404c8060cea99e29c50677612b1193c0a3481624ad1dc6f3ceb485021f41/getsentry/sentry-javascript/issues/22794 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc5d404c8060cea99e29c50677612b1193c0a3481624ad1dc6f3ceb485021f41/getsentry/sentry-javascript/issues/22794 |
| 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 | isaacrowntree |
| 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