Skip to content

fix(v10/server-utils): Stop shipping orchestrion bundler plugins as production dependencies - #23667

Merged
andreiborza merged 2 commits into
v10from
ab/v10-orchestrion-bundle-deps
Aug 27, 2026
Merged

fix(v10/server-utils): Stop shipping orchestrion bundler plugins as production dependencies#23667
andreiborza merged 2 commits into
v10from
ab/v10-orchestrion-bundle-deps

Conversation

@andreiborza

Copy link
Copy Markdown
Member

Backport of: #22443

Closes: #23611

@sentry/server-utils shipped the orchestrion bundler plugins and a full JavaScript parser toolchain (meriyah, esquery, astring, source-map) as production dependencies, so every consumer of @sentry/node installed roughly 5 MB of code that no runtime path reaches unless they opt into diagnostics-channel injection. The orchestrion runtime chain is now compiled into this package's own build, and all @apm-js-collab/* packages plus meriyah become devDependencies. Production dependencies are down to @sentry/conventions and @sentry/core.

Differences to the original PR

  • packages/server-utils/src/orchestrion/runtime/register.ts: kept RegisterDiagnosticsChannelInjectionOptions and the optional parameter on registerDiagnosticsChannelInjection(), now deprecated and ignored. The original deletes both; on v10 the option is reachable through the public experimentalUseDiagnosticsChannelInjection(options), so removing it would be a compile error for anyone passing tracingHooksDir.
  • packages/node/src/sdk/experimentalUseDiagnosticsChannelInjection.ts: same reason, the optional parameter stays.
  • packages/server-utils/src/orchestrion/runtime/register.ts: kept v10's loader-thread guard (isMainThread / parentPort), which landed after the v10 branch point and is not in the original.
  • packages/nextjs/src/config/withSentryConfig/getFinalConfigObjectUtils.ts and getFinalConfigObject.ts: removed maybeAddOutputFileTracingIncludes plus its tests in packages/nextjs/test/config/withSentryConfig.test.ts. That @vercel/nft force-include is a v10-only workaround for meriyah's module-sync exports map (meriyah.mjs missing at runtime in Next.js "standalone" builds since 10.59.0 (server-utils → meriyah not fully traced by nft) #23034), which bundling removes. develop never carried it, so this brings both branches to the same state.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c10ca96. Configure here.

Comment thread packages/server-utils/src/orchestrion/runtime/register.ts
Comment thread packages/nextjs/src/config/diagnosticsChannelInjection.ts
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.75 kB added added
@sentry/browser - with treeshaking flags 26.19 kB added added
@sentry/browser (incl. Tracing) 46.6 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.39 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.36 kB added added
@sentry/browser (incl. Tracing, Replay) 85.86 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.5 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 90.58 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.23 kB added added
@sentry/browser (incl. Feedback) 44.92 kB added added
@sentry/browser (incl. sendFeedback) 32.54 kB added added
@sentry/browser (incl. FeedbackAsync) 37.68 kB added added
@sentry/browser (incl. Metrics) 28.83 kB added added
@sentry/browser (incl. Logs) 29.06 kB added added
@sentry/browser (incl. Metrics & Logs) 29.75 kB added added
@sentry/react 29.56 kB added added
@sentry/react (incl. Tracing) 48.86 kB added added
@sentry/vue 33.18 kB added added
@sentry/vue (incl. Tracing) 48.57 kB added added
@sentry/svelte 27.77 kB added added
CDN Bundle 30.14 kB added added
CDN Bundle (incl. Tracing) 48.57 kB added added
CDN Bundle (incl. Logs, Metrics) 31.72 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.87 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.01 kB added added
CDN Bundle (incl. Tracing, Replay) 86.09 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.39 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.89 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.17 kB added added
CDN Bundle - uncompressed 89.87 kB added added
CDN Bundle (incl. Tracing) - uncompressed 146.79 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.58 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.77 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.41 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.1 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 270.06 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.8 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.75 kB added added
@sentry/nextjs (client) 51.41 kB added added
@sentry/sveltekit (client) 47.02 kB added added
@sentry/core/server 80.5 kB added added
@sentry/core/browser 66.72 kB added added
@sentry/node-core 63.27 kB added added
@sentry/node 125.76 kB added added
@sentry/node (incl. diagnostics channel injection) 169.82 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 51.43 kB added added
@sentry/node - without tracing 74.95 kB added added
@sentry/aws-serverless 84.22 kB added added
@sentry/cloudflare (withSentry) - minified 202.05 kB added added
@sentry/cloudflare (withSentry) 496.75 kB added added

@andreiborza
andreiborza marked this pull request as ready for review August 27, 2026 12:18
@andreiborza
andreiborza requested review from a team as code owners August 27, 2026 12:18
@andreiborza
andreiborza requested review from chargome and s1gr1d and removed request for a team August 27, 2026 12:18
Comment thread packages/server-utils/src/orchestrion/bundler/webpack.ts
@andreiborza
andreiborza merged commit 83c644d into v10 Aug 27, 2026
311 of 315 checks passed
@andreiborza
andreiborza deleted the ab/v10-orchestrion-bundle-deps branch August 27, 2026 12:43
lifefloating added a commit to llm-ring/lmring that referenced this pull request Aug 31, 2026
- update all minor/patch versions across workspace
- pin @sentry/nextjs to ~10.71.0: 10.72.0 vendored
  @apm-js-collab/code-transformer-bundler-plugins with a rollup CJS
  import.meta.url shim that crashes under DOM-emulated vitest
  environments (ERR_INVALID_URL_SCHEME via document.baseURI);
  upstream fix tracked in getsentry/sentry-javascript#23667
s1gr1d added a commit that referenced this pull request Sep 2, 2026
Since 10.72.0, importing `@sentry/nextjs` on the server crashes when a
`document` global exists. jsdom and happy-dom define one while tests run
in Node (#23789, introduced by #23667).

What went wrong:

1. `@sentry/server-utils` now bundles the code-transformer plugin,
compiled from ESM to CJS. Rollup replaces `import.meta.url` with a
snippet that assumes "a `document` global means a browser". This is now
fixed by always emitting the Node form, since this package only runs in
Node.
2. The Next.js server entry re-exports `withSentryConfig`, so just
importing the SDK ran the bundler plugin's module-scope code. The
plugins now load lazily when the build config actually runs. Build
behavior is unchanged (still synchronous, Next.js webpack configs can't
be async), but importing the SDK no longer touches them. This also
removes the `WebAssembly.compile()` call behind the Cloudflare
cold-start errors (reference - but needs to be verified
[#22794](#22794))


Fixes #23789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants