fix(server-utils): Keep orchestrion registration out of tree-shaking - #23590
Merged
Conversation
The bundler transform injected a bare `orchestrionModuleInjected(...)` call. The helper returns `void` and `@sentry/server-utils` sets `sideEffects: false`, so bundlers may prove the statement droppable. rollup 4.63.0 does, and removes the registration: instrumented modules publish on their channel, but nothing subscribes, so no spans are recorded. Assign the result to a `globalThis` property. A write to a global is a side effect no bundler can shake out, so the call survives while the rest of the package still tree-shakes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
logaretm
approved these changes
Aug 25, 2026
3 tasks
andreiborza
added a commit
that referenced
this pull request
Aug 26, 2026
…ing (#23591) Backport of: #23590 ## Differences to the original PR - Applied to `packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts` instead of `moduleInjectedTransform.ts`. v10 predates that refactor, so the injected snippet calls `registerOrchestrionChannelIntegration` rather than `orchestrionModuleInjected`. The defect is the same: that helper also returns `void`, and v10's `@sentry/server-utils` also sets `sideEffects: false`. - Test updated in `test/orchestrion/subscribeInjection.test.ts` rather than `test/orchestrion/moduleInjectedTransform.test.ts`, for the same reason.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Keep the orchestrion registration that the bundler transform injects from being tree-shaken away.
orchestrionModuleInjected(...)result to aglobalThisproperty instead of discarding it.Why
The helper returns
voidand@sentry/server-utilssetssideEffects: false, so a bare call statement is one a bundler can prove droppable. rollup 4.63.0 (released 2026-08-25) does, and drops the registration. Instrumented modules then publish on their diagnostics channel with nothing subscribed, so no spans are recorded. This currently breaks every Cloudflare E2E app that instruments through the vite transform, and it silently disables DB instrumentation for users on vite or rollup 4.63.0 and later.