Skip to content

fix(nitro): Anchor both nitro integrations on h3 for Cloudflare auto-injection - #24897

Open
mydea wants to merge 3 commits into
feat/nitro-move-to-server-utilsfrom
feat/nitro-anchor-both-on-h3
Open

mydea wants to merge 3 commits into
feat/nitro-move-to-server-utilsfrom
feat/nitro-anchor-both-on-h3

Conversation

@mydea

@mydea mydea commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Stacked on #24861.

Addresses review feedback on the orchestrion registration: nitroServerTimingIntegration was anchored on unstorage (because the registration mapped one integration per module and h3 was taken by nitroIntegration). unstorage is practically always evaluated in a Nitro app, but it isn't the guaranteed HTTP module — so a Nitro app that didn't load it would silently fail to register the Server-Timing headers on a bundler-only SDK like @sentry/cloudflare, breaking pageload trace propagation with no error.

This lets a single module register multiple integrations and anchors both nitro integrations on h3 — the module every HTTP-serving Nitro app loads.

  • channel-integration-definitions.ts: both nitro entries → h3; subscriberExportForModule → subscriberExportsForModule (returns all exports for a module).
  • The injected snippet emits one registration call per export (single-export output is byte-identical to before).
  • The global orchestrion marker value is factory | Set<factory>: a module keeps a single factory for the common one-integration case (so an older reader stays compatible) and upgrades to a Set only once it registers a second integration. @sentry/cloudflare reads either shape.
  • config/nitro.ts drops the now-unnecessary unstorage anchor.

Only affects the Cloudflare (bundler-only) path — on node/deno/bun these integrations are registered statically.

🤖 Generated with Claude Code

@mydea
mydea added this pull request to stack #24871 September 30, 2026 13:45

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/cloudflare/test/sdk.test.ts
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.82 kB - -
@sentry/browser - with treeshaking flags 27.95 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.86 kB - -
@sentry/browser (incl. Tracing) 51.96 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.96 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.91 kB - -
@sentry/browser (incl. Tracing, Replay) 91.69 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.57 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.41 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.38 kB - -
@sentry/browser (incl. Feedback) 47.34 kB - -
@sentry/browser (incl. sendFeedback) 34.87 kB - -
@sentry/browser (incl. FeedbackAsync) 39.98 kB - -
@sentry/browser (incl. Metrics) 30.84 kB - -
@sentry/browser (incl. Logs) 31.13 kB - -
@sentry/browser (incl. Metrics & Logs) 31.77 kB - -
@sentry/react 31.65 kB - -
@sentry/react (incl. Tracing) 54.28 kB - -
@sentry/vue 37.95 kB - -
@sentry/vue (incl. Tracing) 54.87 kB - -
@sentry/svelte 29.84 kB - -
@sentry/remix (Remix 3 client bundle) 56.97 kB - -
CDN Bundle 31.55 kB - -
CDN Bundle (incl. Tracing) 52.47 kB - -
CDN Bundle (incl. Logs, Metrics) 33.75 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.67 kB - -
CDN Bundle (incl. Tracing, Replay) 90.13 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.06 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.22 kB - -
CDN Bundle - uncompressed 92.91 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.72 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.45 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.67 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.48 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.88 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.58 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.51 kB - -
@sentry/nextjs (client) 56.67 kB - -
@sentry/sveltekit (client) 52.35 kB - -
@sentry/core/server 40.99 kB - -
@sentry/core/browser 13.81 kB - -
@sentry/node 153.66 kB +1.12% +1.7 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.79 kB +0.03% +20 B 🔺
@sentry/node - without tracing 94.82 kB +0.32% +298 B 🔺
@sentry/node - without channel injection 131.86 kB +1.32% +1.71 kB 🔺
@sentry/aws-serverless 102.95 kB +0.27% +274 B 🔺
@sentry/cloudflare (withSentry) - minified 210.46 kB +0.04% +79 B 🔺
@sentry/cloudflare (withSentry) 521.75 kB +0.03% +142 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 228.13 kB +0.04% +79 B 🔺

View base workflow run

@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from a38c9f8 to b12d5d7 Compare September 30, 2026 14:13
@mydea mydea closed this Sep 30, 2026
@mydea mydea reopened this Oct 1, 2026
@mydea
mydea removed this pull request from stack #24871 October 1, 2026 06:50
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from b12d5d7 to 42650ee Compare October 1, 2026 06:51
@mydea
mydea changed the base branch from feat/nuxt-strip-update-route-name to feat/nitro-move-to-server-utils October 1, 2026 06:51

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/server-utils/src/orchestrion/config/nitro.ts
@mydea
mydea added this pull request to stack #24913 October 1, 2026 07:14
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch 2 times, most recently from b7712e1 to 1a7314a Compare October 1, 2026 07:17

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/server-utils/src/utils/moduleInjected.ts Outdated
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from 1a7314a to 424ddfa Compare October 1, 2026 11:00

@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 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread dev-packages/e2e-tests/test-applications/nuxt-5/tests/cache.test.ts Outdated
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from 4cf95b6 to a01699a Compare October 1, 2026 12:41
@mydea
mydea marked this pull request as ready for review October 12, 2026 13:13
@mydea
mydea requested review from a team as code owners October 12, 2026 13:13
@mydea
mydea requested review from JPeer264, isaacs, nicohrubec and s1gr1d and removed request for a team October 12, 2026 13:13
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from a01699a to 4316c1b Compare October 12, 2026 13:18
mydea and others added 3 commits October 12, 2026 15:55
…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) <noreply@anthropic.com>
…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) <noreply@anthropic.com>
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 <noreply@anthropic.com>
@mydea
mydea force-pushed the feat/nitro-anchor-both-on-h3 branch from 4316c1b to 800b14e Compare October 12, 2026 13:55

This branch has not been deployed

No deployments
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.

1 participant