GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(nitro): Anchor both nitro integrations on h3 for Cloudflare auto-injection by mydea · Pull Request #24897 · getsentry/sentry-javascript Conversation
|
size-limit report 📦
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2a97f05 to
01d3ad1
Compare
a38c9f8 to
b12d5d7
Compare
b12d5d7 to
42650ee
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
b7712e1 to
1a7314a
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
d93c0f9 to
a6ecc88
Compare
1a7314a to
424ddfa
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 424ddfa. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
4cf95b6 to
a01699a
Compare
73ba6de to
eb9579a
Compare
a01699a to
4316c1b
Compare
…injection The orchestrion registration previously mapped one integration per module, so `nitroServerTimingIntegration` was anchored on `unstorage` while `nitroIntegration` took `h3`. `unstorage` is practically always evaluated in a Nitro app, but it is not the guaranteed HTTP module, so a Nitro app that did not load it would silently fail to register Server-Timing (breaking pageload trace propagation) on a bundler-only SDK like `@sentry/cloudflare`. Let a module register several integrations, and anchor both nitro integrations on `h3` — the module every HTTP-serving Nitro app loads. The global orchestrion marker now stores a Set of factories per module; the injected snippet emits one registration call per export; and cloudflare instantiates all of them. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ctories The prior test only exercised the init-time path with a Set of factories. Add a test that emits `orchestrion.module-injected` for a module holding a Set, so the late-registration listener's Set-unwrapping is covered with more than one factory too. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Emitting one `orchestrionModuleInjected` call per export made the helper merge factories across calls, but every instrumented file of a package injects its own fresh thunk for the same integration. Packages split across files (pg, amqplib, ...) therefore accumulated duplicate factories and were upgraded to a Set despite having a single integration, breaking the plain-factory shape kept for older readers. The snippet now passes all of a module's factories in a single call, and the helper treats each call as the module's complete list and replaces the entry: one factory stays a plain factory, several become a Set. This also announces `h3` once per file instead of once per integration. Adds a transform test for the multi-export `h3` injection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4316c1b to
800b14e
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove a layer of complexity by settling on a single shape here, since we pin versions and don't normally support skew anyway, but this is also fine as-is.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * instantiates them. | ||
| */ | ||
| integrations?: Map<string, () => Integration>; | ||
| integrations?: Map<string, (() => Integration) | Set<() => Integration>>; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This dual factory | Set shape does not give the compatibility it claims, for the only module that uses it. I think we should pick one and simplify it.
The marker field has shipped since #22094 as Map<string, () => Integration>. This PR keeps a plain factory for single-integration modules "so an older reader stays compatible".
But h3 is now always a Set. A released @sentry/cloudflare reader does [...registered.values()].map(factory => factory()), which throws TypeError: factory is not a function on the Set. That throw happens inside getDefaultIntegrations during init(), so a Nitro app with version skew between the injected @sentry/server-utils and @sentry/cloudflare would fail at init, not just miss an integration.
@sentry/cloudflare pins @sentry/server-utils to an exact version, so skew needs two installed copies (for example an app-level @sentry/server-utils dependency at another version), which would be very surprising, and we could easily say is unsupported. But then the compat argument is weak for every module, and the dual shape is complexity for nothing. If skew is a real concern (which I'm not convinced it is), the current design would still break for exactly the Nitro case this PR targets.
Suggestion: Treat writer/reader skew as unsupported, as the exact pin already implies. Store one shape always (Set or array) for every module. Drop the [first, ...rest] branching in moduleInjected.ts, the instanceof Set checks in both baseSdk.ts readers, and the compat wording in this comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yeah good point, I rewrote it to expect an array only!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Writer/reader version skew is already unsupported (`@sentry/cloudflare` pins `@sentry/server-utils` exactly), and the dual factory | Set shape did not keep older readers working for `h3` anyway. Always store the module's factory list as an array so the readers no longer need to branch on the shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le-injected snippet Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: isaacs <[email protected]>
|
Superseded by #25349, which merges the two nitro integrations into a single |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The point Isaac brought up seems to be in already and is indeed cleaner now.
edit: That aged like milk
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…tion` (#25349) Stacked on #24861. Replaces #24897. `nitroServerTimingIntegration` only existed as a separate integration because `nitroIntegration` was tracing-gated, while Server-Timing trace propagation must work in tracing-without-performance mode. That split meant Cloudflare auto-injection needed a second anchor module (`unstorage`), since a module registers a single integration, and a Nitro app that never loaded `unstorage` would silently lose the headers. #24897 tried to fix that by letting one module register several integrations, which complicated the global marker shape. Instead, there is now a single `nitroIntegration` with options to opt out of parts of it, both enabled by default: ```ts nitroIntegration({ serverTiming: false, // no Server-Timing sentry-trace/baggage headers storage: false, // no unstorage cache spans }); ``` It's registered as a default integration rather than a tracing one, like express/hono/koa: without tracing, the spans it starts are non-recording, and the Server-Timing headers still propagate. It's anchored on `h3` alone, which every HTTP-serving Nitro app loads, so the marker keeps its single-factory shape. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.