Skip to content

ref(nitro): Move channel-based instrumentation into @sentry/server-utils - #24861

Merged
mydea merged 14 commits into
developfrom
feat/nitro-move-to-server-utils
Oct 19, 2026
Merged

mydea merged 14 commits into
developfrom
feat/nitro-move-to-server-utils

Conversation

@mydea

@mydea mydea commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Moves Nitro's node:diagnostics_channel-based instrumentation out of @sentry/nitro and into @sentry/server-utils, so it is no longer tied to the Nitro package and can be provided by any server SDK. This mirrors the Hono → server-utils move.

The runtime instrumentation splits into two integrations:

  • nitroIntegration — h3/srvx HTTP + middleware spans and unstorage cache spans. It only creates spans, so it is a tracing integration, registered via getTracingIntegrations(). That makes it available (and on by default) in node, deno and bun.
  • nitroServerTimingIntegration — sets the Server-Timing response headers that carry sentry-trace/baggage so the browser SDK can connect a pageload to the backend trace. This must work even when tracing is disabled (trace-without-performance), so it is a default (non-tracing) integration, registered via getErrorIntegrations(). It is opt-out-able independently.

Both integrations subscribe to h3's tracing channels, so they are inert unless a Nitro app (the only real emitter of those channels) is running.

Cloudflare (and other bundler-only SDKs) get both integrations auto-injected via orchestrion registration-only configs: h3 and unstorage are transformed at build time to register the matching factory, which @sentry/cloudflare instantiates at init(). These are registration-only (no channels injected — the libraries publish their own), so they are excluded from the runtime loader and are a no-op on node/deno/bun, where the integrations are registered statically.

Non-breaking: @sentry/nitro's init() goes through @sentry/node's default integrations, which now include both of the above, so existing Nitro-on-Node apps get exactly the same spans and headers as before — just sourced from the integrations rather than the runtime plugin. @sentry/nitro no longer depends on @sentry/server-utils.

Why error capture stays in @sentry/nitro

Error capture is intentionally not moved. Nitro's error hook is a broad boundary (request/response-hook, plugin-init, cache and process-level unhandled* errors, plus contexts.nitro tags/method/path). The tracing channels only see errors thrown through a traced handler, so folding error capture into a channel-based integration would lose coverage and force an h3 coupling into the framework-neutral package. It remains in the Nitro runtime plugin's error hook.

E2E coverage

A new cloudflare-nitro e2e app (raw Nitro 3 on the cloudflare_module preset) exercises the Cloudflare auto-injection end to end — asserting auto.http.nitro.* spans, auto.cache.nitro cache spans, and the Server-Timing header, which also confirms the tracing channels bind under Cloudflare's async-context strategy. Since raw Nitro has no first-class Cloudflare init helper yet, the app wires init by hand (a Nitro server plugin wrapping nitroApp.fetch with wrapRequestHandler, mirroring @sentry/nuxt); a supported helper could be a good follow-up.

🤖 Generated with Claude Code

@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/integrations/index.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.88 kB - -
@sentry/browser - with treeshaking flags 28.02 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.92 kB - -
@sentry/browser (incl. Tracing) 52.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.07 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.02 kB - -
@sentry/browser (incl. Tracing, Replay) 91.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.68 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.55 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.49 kB - -
@sentry/browser (incl. Feedback) 47.4 kB - -
@sentry/browser (incl. sendFeedback) 34.94 kB - -
@sentry/browser (incl. FeedbackAsync) 40.05 kB - -
@sentry/browser (incl. Metrics) 30.9 kB - -
@sentry/browser (incl. Logs) 31.18 kB - -
@sentry/browser (incl. Metrics & Logs) 31.81 kB - -
@sentry/react 31.7 kB - -
@sentry/react (incl. Tracing) 54.39 kB - -
@sentry/vue 38.04 kB - -
@sentry/vue (incl. Tracing) 55.01 kB - -
@sentry/svelte 29.9 kB - -
@sentry/remix (Remix 3 client bundle) 57.08 kB - -
CDN Bundle 31.64 kB - -
CDN Bundle (incl. Tracing) 52.58 kB - -
CDN Bundle (incl. Logs, Metrics) 33.84 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.52 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.77 kB - -
CDN Bundle (incl. Tracing, Replay) 90.25 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.18 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.34 kB - -
CDN Bundle - uncompressed 93.18 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.03 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.99 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.76 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.2 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.84 kB - -
@sentry/nextjs (client) 56.8 kB - -
@sentry/sveltekit (client) 52.45 kB - -
@sentry/core/server 41.12 kB - -
@sentry/core/browser 13.81 kB - -
@sentry/node 154.79 kB +1.12% +1.71 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.07 kB +0.04% +29 B 🔺
@sentry/node - without tracing 95.18 kB +0.33% +311 B 🔺
@sentry/node - without channel injection 132.81 kB +1.27% +1.66 kB 🔺
@sentry/aws-serverless 103.32 kB +0.28% +282 B 🔺
@sentry/cloudflare (withSentry) - minified 210.6 kB - -
@sentry/cloudflare (withSentry) 522.53 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 228.27 kB - -

View base workflow run

@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 #24871 September 30, 2026 08:41
@mydea
mydea force-pushed the feat/nitro-move-to-server-utils branch 2 times, most recently from e8a310d to 810fa6c Compare September 30, 2026 12:26
@mydea
mydea marked this pull request as ready for review September 30, 2026 12:30
@mydea
mydea requested review from a team as code owners September 30, 2026 12:30
@mydea
mydea requested review from a team, JPeer264, isaacs, logaretm, nicohrubec and s1gr1d and removed request for a team September 30, 2026 12:30
{ exportName: 'redisIntegration', modules: ['redis', '@redis/client', 'ioredis'] },
{ exportName: 'dataloaderIntegration', modules: ['dataloader'] },
{ exportName: 'nitroIntegration', modules: ['h3'] },
{ exportName: 'nitroServerTimingIntegration', modules: ['unstorage'] },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The nitroServerTimingIntegration may silently fail to register on Cloudflare if unstorage is tree-shaken from a minimal Nitro app, breaking trace propagation.
Severity: MEDIUM

Suggested Fix

To ensure robust registration, the module dependency for nitroServerTimingIntegration should be changed from ['unstorage'] to ['h3']. Since h3 is a guaranteed dependency in any Nitro application, this change ensures the integration is always registered when needed. The configuration should be updated to { exportName: 'nitroServerTimingIntegration', modules: ['h3'] }.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
packages/server-utils/src/orchestrion/config/channel-integration-definitions.ts#L64

Potential issue: The registration of `nitroServerTimingIntegration` for Cloudflare
Workers is configured to trigger upon detection of the `unstorage` module. This relies
on the assumption that `unstorage` is a core, non-tree-shakable dependency in all Nitro
applications. However, if a minimal Nitro application can be built without `unstorage`,
the integration will silently fail to register. This would result in the `sentry-trace`
and `baggage` headers not being set, breaking distributed tracing for affected
applications without any error or warning.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added a fix for this in a separate PR on this stack here: #24897

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

@logaretm logaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we merge both nitro integrations into one integration that enables either instrumentation with options?

nitroIntegration({
  // defaults, or flip em to `disabeXXX`
  serverTiming: true,
  storageInstrumentation: true,
   // other instrumentations
})

@mydea
mydea force-pushed the feat/nitro-move-to-server-utils branch from d93c0f9 to a6ecc88 Compare October 1, 2026 10:59
@mydea
mydea force-pushed the feat/nitro-move-to-server-utils branch from 73ba6de to eb9579a Compare October 12, 2026 13:18

@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 dev-packages/node-integration-tests/suites/tracing/nitro/test.ts
@mydea
mydea removed this pull request from stack #24913 October 14, 2026 07:32
@mydea
mydea added this pull request to stack #25350 October 14, 2026 07:32
@mydea
mydea force-pushed the feat/nitro-move-to-server-utils branch from 69a9819 to d900bc4 Compare October 16, 2026 06:57

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

mydea and others added 14 commits October 19, 2026 09:55
Extract Nitro's diagnostics-channel instrumentation out of `@sentry/nitro`
into `@sentry/server-utils`, so any server SDK can provide it:

- `nitroIntegration` (h3/srvx HTTP + middleware spans, unstorage cache spans)
  is a tracing integration, registered via `getTracingIntegrations()` and so
  available in node, deno and bun.
- `nitroServerTimingIntegration` sets the `Server-Timing` trace-propagation
  headers. It is a default (non-tracing) integration so it also runs in
  tracing-without-performance mode, and can be opted out separately.

Error capture stays in `@sentry/nitro`'s runtime plugin (its Nitro `error`
hook), which a channel-based integration cannot replace without losing
coverage. `@sentry/nitro` keeps getting all of this through the underlying
`@sentry/node` defaults, so nothing changes for existing Nitro-on-Node apps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…orchestrion

Add registration-only orchestrion configs so the Nitro integrations are
auto-registered on bundler-only SDKs like `@sentry/cloudflare`, which discover
a bundled module via the module-injected event and instantiate its factory.

The snippet maps one integration per module, so two anchors are used, both core
Nitro dependencies evaluated at startup: `h3` (dist/h3.mjs) registers
`nitroIntegration` (spans) and `unstorage` (dist/index.mjs) registers
`nitroServerTimingIntegration`. These are registration-only (no channels are
injected, the libraries publish their own), so they are excluded from the
runtime loader and are a no-op on node/deno/bun, where the integrations are
registered statically.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…trion config

Document why the h3/unstorage registration-only ranges use the `-0` suffix: the
orchestrion matcher is the vendored `semifies` (not node-semver), where a range
carrying a prerelease tag matches prereleases across patch tuples — so
`>=2.0.0-0` matches the `2.0.1-rc.*` / `2.0.0-alpha.*` versions Nitro 3 ships.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a raw Nitro 3 app deployed to Cloudflare (Workers, `cloudflare_module`
preset) that exercises the orchestrion registration-only path on a bundler-only
SDK: the app imports no Nitro instrumentation, and `nitroIntegration` /
`nitroServerTimingIntegration` are auto-injected via the orchestrion transform
over h3/unstorage and instantiated by `@sentry/cloudflare` at init.

Tests assert `auto.http.nitro.*` spans, `auto.cache.nitro` cache spans, and the
`Server-Timing` trace-propagation header — i.e. the whole auto-injection path,
including that the tracing channels bind under Cloudflare's async-context
strategy.

Init mirrors what @sentry/nuxt does for Nitro-on-Cloudflare (no first-class
raw-Nitro Cloudflare helper exists): a Nitro server plugin wraps `nitroApp.fetch`
with `wrapRequestHandler`, and the orchestrion rollup/rolldown plugin is wired
into the Nitro build config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `mod.test.ts` snapshots captured the full `sdk.integrations` list, so any
change to the default integrations (such as the new nitro integrations) broke
them even though the list is incidental to what these tests verify. Normalize
`sdk.integrations` to a placeholder, like the other volatile fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stacked on develop's hono size bump: the nitro integrations add on top, so
@sentry/node needs 146 KB and the no-channel-injection variant 125 KB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`nitroIntegration` is part of the Node tracing integrations, but the Nitro SDK
should always include it regardless of that gating. Add it explicitly to the
Nitro SDK's default integrations (deduped by name when both are added), and
re-export `nitroIntegration`/`nitroServerTimingIntegration` from `@sentry/node`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nitroIntegration and nitroServerTimingIntegration are exported from
@sentry/node, so every SDK with an explicit re-export list needs them too
(caught by the node-exports-test-app consistency check). Deno and Bun also
enable them by default via getTracingIntegrations().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com>
Drives h3 v2, srvx and unstorage with their tracing plugins enabled, which
publish the same diagnostics channels as a Nitro app, so the integrations
are covered on Node without a Nitro build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ite`

Bun 1.3 drops the newline of a `console.log` call when the string is exactly
4096 bytes, so an envelope of that size gets merged with the next one into a
single line that the integration test runner can't parse. The runner then waits
for an envelope it already received until the test times out, which made the
Bun 1.3 integration tests flaky (e.g. `captureMessage/with_level`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mydea
mydea force-pushed the feat/nitro-move-to-server-utils branch from f7da752 to 78f185c Compare October 19, 2026 07:58

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

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 78f185c. Configure here.

setupOnce() {
captureTracingEvents();
captureStorageEvents();
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Span setup skips tracing-channel wait

Medium Severity

nitroIntegration calls captureTracingEvents() and captureStorageEvents() directly from setupOnce, without waitForTracingChannelBinding. Sibling native-channel integrations (dataloader, knex, native GraphQL) wait so bindTracingChannelToSpan can parent spans. If the async-context binding is not ready yet — common with a custom OpenTelemetry setup — the bind no-ops, __SENTRY_NITRO_HTTP_CHANNELS_INSTRUMENTED__ is still set, and Nitro HTTP/cache spans are never created. The old runtime plugin ran after init(), so this race is new.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 78f185c. Configure here.


diagnosticsChannel.tracingChannel<H3TracingRequestEvent>('h3.request').start.subscribe(message => {
setServerTimingHeaders((message as H3TracingRequestEvent).event);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Server-Timing subscriber can throw into h3

Low Severity

The h3.request start subscriber calls setServerTimingHeaders with no safeChannelCallback (or other try/catch). A throw from getTraceData(), a missing event, or headers.append on immutable headers propagates through diagnostics_channel into h3’s request path and can fail the user request. This integration is now a default on every Node-based SDK, so the blast radius is larger than the old Nitro plugin.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 78f185c. Configure here.

@mydea
mydea merged commit 17e81ca into develop Oct 19, 2026
375 checks passed
@mydea
mydea deleted the feat/nitro-move-to-server-utils branch October 19, 2026 08:20
mydea added a commit that referenced this pull request Oct 19, 2026
…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 <noreply@anthropic.com>
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 24, 2026
| datasource | package             | from   | to     |
| ---------- | ------------------- | ------ | ------ |
| npm        | @sentry/vite-plugin | 11.8.0 | 11.9.0 |


## [v11.9.0](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#1190)

##### Important Changes

- **feat: Rename `diagnostic_channel`, fetch and gRPC span origins ([#25601](getsentry/sentry-javascript#25601

  Some span origins changed their names to match the other v11 origins:

  - `auto.graphql.diagnostic_channel` is now `auto.graphql.graphql`.
  - `auto.db.redis.diagnostic_channel`, `auto.db.mysql2.diagnostic_channel` and `auto.db.mongoose.diagnostic_channel` now end in `.native_channel`.
  - `auto.http.wintercg_fetch` is now `auto.http.fetch`, as on Bun, Deno and Cloudflare.
  - `auto.grpc.serverless` is now `auto.grpc.google_cloud`.

  If you have `ignoreSpans` rules, queries or alerts on the old origins, change them to use the new origins.

- **feat(deno): Add incoming request options to `denoServeIntegration` ([#25493](getsentry/sentry-javascript#25493

  `denoServeIntegration` now accepts `ignoreRequestBody`, `ignoreIncomingRequests`, `ignoreStaticAssets`, `spans`, `onSpanCreated` and `onSpanEnd`, with the same meaning as in `denoHttpIntegration`. The callbacks receive the web `Request`.

  `ignoreStaticAssets` defaults to `true`, so `Deno.serve` no longer creates spans for `GET` requests to common static assets such as `favicon.ico`, `robots.txt` or `*.js` files. To keep these spans, set `denoServeIntegration({ ignoreStaticAssets: false })`. `Deno.serve` spans also follow the client's tracing configuration by default, so the integration does not start spans when tracing is disabled.

- **feat(deno): Record request sessions for `Deno.serve` ([#25496](getsentry/sentry-javascript#25496

  `denoServeIntegration` now records a request session for each incoming request, as `denoHttpIntegration` does for `node:http`. This gives release health and crash-free rates for `Deno.serve` apps. Sessions are sent only when a `release` is set. To turn them off, set `denoServeIntegration({ sessions: false })`. `sessionFlushingDelayMS` sets how long the SDK waits before it sends the session aggregate.

- **feat(deno): Register channel injection hooks from `init()` ([#25546](getsentry/sentry-javascript#25546

  `Sentry.init()` in `@sentry/deno` now registers the diagnostics-channel injection hooks, as `@sentry/node` does. The channel integrations now record spans without `--preload=npm:@sentry/deno/import`, for modules that you import after `init()`. To also instrument modules that load before `init()`, such as static imports in your entry module, keep the preload. With `debug: true`, the SDK logs a warning when no injection is active.

  On Node.js, tracing-hooks messages now show with `debug: true` instead of with `DEBUG=@apm-js-collab/*`.

- **feat(nextjs): Add a tunnel route handler that sends only the event payload to Sentry ([#25456](getsentry/sentry-javascript#25456

  The `tunnelRoute` option can now send events through a route handler in your app. The handler forwards only the event payload to Sentry, and no request headers. To use it, add this file next to your `tunnelRoute` option:

  ```ts
  // app/sentry-tunnel/route.ts (or src/app/sentry-tunnel/route.ts)
  export { POST } from '@sentry/nextjs/tunnel';
  ```

  The handler accepts events for the DSN of your server SDK. To accept other DSNs, use `createSentryTunnelRoute({ allowedDsns })` from the same import. Without the file, the tunnel route works as before.

  Also, the server no longer sends spans of tunnel requests when span streaming is on, because these spans only show the SDK's own traffic.

- **feat(nextjs): Never emit trace meta tags from a prerender ([#25141](getsentry/sentry-javascript#25141

  Pageloads of apps with `cacheComponents` enabled are connected to their server request again. Pages that Next.js prerenders no longer carry trace information, so a cached page can no longer connect visitors to a request that was not theirs. This also applies to ISR pages. The pageload waits for the trace information when it arrives with the part of the page that streams in after a cached shell.

  If you set up OpenTelemetry yourself and register `SentryPropagator`, register `NextSentryPropagator` instead and pass your tracer provider to `markPrerendersOnTracerProvider`, so that your prerendered pages carry no trace information either.

- **feat(nextjs): Send tunnel route requests with `credentials: 'omit'` ([#25509](getsentry/sentry-javascript#25509

  With `tunnelRoute` and no tunnel route handler, `@sentry/nextjs` now sends events from the browser with `credentials: 'omit'`, because the tunnel route does not need cookies.
  If a layer in front of your app checks cookies before it lets requests through (for example Vercel Deployment Protection), you can send them again in your browser `Sentry.init` call:

  ```js
  // instrumentation-client.ts
  Sentry.init({
    transportOptions: { fetchOptions: { credentials: 'same-origin' } },
  });
  ```

- **feat(nitro): Report a single `http.server` span per request ([#25295](getsentry/sentry-javascript#25295

  A Nitro request now creates only one `http.server` span. The nested `http.server` spans with the origins `auto.http.nitro.srvx` and `auto.http.nitro.h3` are removed. h3 route handlers now get a `handler` span, and middleware spans are direct children of the `http.server` span. If you have queries or alerts on the removed spans, change them to use the `http.server` span or the `handler` span.

- **fix: Use `auto.http.http_server` origin for all `node:http` server spans ([#25604](getsentry/sentry-javascript#25604

  On Bun and Deno, `node:http` server spans now have the origin `auto.http.http_server` instead of `auto.http.server`, as on Node.js. On Node.js, nothing changes. `Bun.serve` spans keep `auto.http.bun.serve` and `Deno.serve` spans keep `auto.http.deno`. If you have `ignoreSpans` or `beforeSendSpan` rules, queries or alerts on `auto.http.server`, change them to use `auto.http.http_server`.

##### Other Changes

- feat(browser): Add `LoaderSentry` type export ([#25357](getsentry/sentry-javascript#25357))
- feat(cloudflare): Add `isStreamingResponse` option and detect streamed RSC responses ([#24932](getsentry/sentry-javascript#24932))
- feat(core): Add `dataCollection.mcp` option ([#25553](getsentry/sentry-javascript#25553))
- feat(core): Limit the body size of tunnel requests ([#25515](getsentry/sentry-javascript#25515))
- feat(nextjs): Link `use cache` hits to their fill across instances ([#25448](getsentry/sentry-javascript#25448))
- feat(nextjs): Wait for the resumed part of a document before starting the pageload ([#25142](getsentry/sentry-javascript#25142))
- feat(nitro): Merge the nitro integrations into a single `nitroIntegration` ([#25349](getsentry/sentry-javascript#25349))
- feat(server-utils): Emit `execute_tool` spans for Anthropic's `beta.messages.toolRunner()` ([#25320](getsentry/sentry-javascript#25320))
- fix(astro): defer to `@sentry/cloudflare/vite` on Cloudflare Workers ([#25347](getsentry/sentry-javascript#25347))
- fix(aws-serverless): End the `function.aws` span when a callback-style handler calls back ([#25543](getsentry/sentry-javascript#25543))
- fix(browser): Skip profiling for unsampled active root spans ([#25498](getsentry/sentry-javascript#25498))
- fix(bundler-plugins): Check `globalThis` before `global` in the injected snippet ([#25365](getsentry/sentry-javascript#25365))
- fix(bundler-plugins): Inject the release only into chunks that load at startup ([#25541](getsentry/sentry-javascript#25541))
- fix(cloudflare): auto-instrument a re-exported default export ([#25345](getsentry/sentry-javascript#25345))
- fix(cloudflare): Deliver check-ins and events from forked isolation scopes ([#25374](getsentry/sentry-javascript#25374))
- fix(cloudflare): Don't hold Durable Object invocations open with the segment-end flush timer ([#25490](getsentry/sentry-javascript#25490))
- fix(cloudflare): keep default exports intact when auto-instrumenting ([#25372](getsentry/sentry-javascript#25372))
- fix(core): Use `trace_metric` data category for metrics rate limits and client reports ([#25606](getsentry/sentry-javascript#25606))
- fix(deps): Allow `@opentelemetry/api` 1.9 again ([#25684](getsentry/sentry-javascript#25684))
- fix(deno): Re-export portable helpers that Cloudflare exposes ([#25491](getsentry/sentry-javascript#25491))
- fix(elysia): Set SDK metadata on the options passed to init ([#24521](getsentry/sentry-javascript#24521))
- fix(elysia): use Node transport on Node runtimes ([#25015](getsentry/sentry-javascript#25015))
- fix(hono): Read connection info from the runtime instead of Hono helpers ([#25552](getsentry/sentry-javascript#25552))
- fix(nextjs): Only inject applicationKey metadata into browser bundles ([#25565](getsentry/sentry-javascript#25565))
- fix(nitro): Use forward slashes for resolved plugin paths on Windows ([#25023](getsentry/sentry-javascript#25023))
- fix(node,vercel-edge,bundler-plugins): Ignore commit env vars set to their own name ([#25244](getsentry/sentry-javascript#25244))
- fix(node): Guard user callbacks in the `node:http` server instrumentation ([#25592](getsentry/sentry-javascript#25592))
- fix(node): Only read JavaScript and TypeScript source files in ContextLines ([#25535](getsentry/sentry-javascript#25535))
- fix(node): restore tsx runtime instrumentation ([#25351](getsentry/sentry-javascript#25351))
- fix(nuxt): Delete Sentry-enabled source maps from Nitro output directories ([#25450](getsentry/sentry-javascript#25450))
- fix(nuxt): Keep sourcesContent in Nuxt 5 server source maps ([#25325](getsentry/sentry-javascript#25325))
- fix(react): Don't crash ErrorBoundary when `error.cause` is not an Error ([#25542](getsentry/sentry-javascript#25542))
- fix(react): Match React Router navigations against root routes only ([#25336](getsentry/sentry-javascript#25336))
- fix(server-runtime-injection): Load ESM hook without the build/esm package.json marker ([#25562](getsentry/sentry-javascript#25562))
- fix(server-utils): Bundle the CommonJS dependencies of instrumented packages on Vite 8 ([#25523](getsentry/sentry-javascript#25523))
- fix(server-utils): Keep OpenAI decision confidence on Vercel AI decide spans ([#25457](getsentry/sentry-javascript#25457))
- fix(server-utils): Nest LangChain run spans under their parent run ([#25364](getsentry/sentry-javascript#25364))
- fix(server-utils): Stop the orchestrion Vite plugin from bundling the CJS build of [@sentry/server-utils](https://github.com/sentry/server-utils) ([#25359](getsentry/sentry-javascript#25359))
- fix(solidstart): Read server action route from the request's root span ([#25513](getsentry/sentry-javascript#25513))
- fix(tanstackstart-react): Delete only the source maps that Sentry enabled ([#25362](getsentry/sentry-javascript#25362))
- fix(vercel-edge): expose portable tracing and feature flag helpers ([#25377](getsentry/sentry-javascript#25377))
- ref(bundler-plugins): Drop [@babel/core](https://github.com/babel/core) peer dependency ([#25406](getsentry/sentry-javascript#25406))
- ref(nitro): Move channel-based instrumentation into [@sentry/server-utils](https://github.com/sentry/server-utils) ([#24861](getsentry/sentry-javascript#24861))

<details>
  <summary> <strong>Internal Changes</strong> </summary>

- build(node): Bump Node to 24.22.1 ([#25634](getsentry/sentry-javascript#25634))
- chore: Add external contributor to CHANGELOG.md ([#25367](getsentry/sentry-javascript#25367))
- chore: Add external contributor to CHANGELOG.md ([#25468](getsentry/sentry-javascript#25468))
- chore: Add external contributor to CHANGELOG.md ([#25483](getsentry/sentry-javascript#25483))
- chore: Add external contributor to CHANGELOG.md ([#25485](getsentry/sentry-javascript#25485))
- chore: Add external contributor to CHANGELOG.md ([#25487](getsentry/sentry-javascript#25487))
- chore: Add external contributor to CHANGELOG.md ([#25500](getsentry/sentry-javascript#25500))
- chore: Add external contributor to CHANGELOG.md ([#25505](getsentry/sentry-javascript#25505))
- chore: Add external contributor to CHANGELOG.md ([#25596](getsentry/sentry-javascript#25596))
- chore: Add external contributor to CHANGELOG.md ([#25597](getsentry/sentry-javascript#25597))
- chore: Add external contributor to CHANGELOG.md ([#25611](getsentry/sentry-javascript#25611))
- chore: Move the monorepo from Yarn 1 to pnpm 12 ([#25354](getsentry/sentry-javascript#25354))
- chore: Update comments related to span links with latest info ([#25135](getsentry/sentry-javascript#25135))
- chore(bugbot): Flag new Cloudflare tests that wrap the worker by hand ([#25619](getsentry/sentry-javascript#25619))
- chore(deps-dev): Bump oxlint and oxfmt ([#25578](getsentry/sentry-javascript#25578))
- chore(deps-dev): Bump vue from 3.2.45 to 3.5.43 ([#25413](getsentry/sentry-javascript#25413))
- chore(deps): Bump `@types/node` to 20 ([#25501](getsentry/sentry-javascript#25501))
- chore(deps): Bump Playwright to 1.64.1 and pin it exactly ([#25382](getsentry/sentry-javascript#25382))
- chore(hono): Remove "ALPHA" from package.json description ([#25521](getsentry/sentry-javascript#25521))
- chore(size-limit): weekly auto-bump ([#25442](getsentry/sentry-javascript#25442))
- ci: Check bundle size increases per PR ([#24737](getsentry/sentry-javascript#24737))
- ci: Empty cached node_modules that have broken `.bin` scripts ([#25635](getsentry/sentry-javascript#25635))
- ci: Fail when a Playwright version drifts from the pinned one ([#25383](getsentry/sentry-javascript#25383))
- ci: Keep Namespace cache volumes complete and cache the pnpm binary ([#25569](getsentry/sentry-javascript#25569))
- ci: Move size check reruns into a local action ([#25600](getsentry/sentry-javascript#25600))
- ci: Read the Playwright version from package.json in install-playwright ([#25380](getsentry/sentry-javascript#25380))
- ci: Run GitHub Actions jobs on Namespace runners ([#25547](getsentry/sentry-javascript#25547))
- ci: Run optional E2E tests in a separate workflow ([#25548](getsentry/sentry-javascript#25548))
- ci: Run the Playwright install's npx outside the repo ([#25384](getsentry/sentry-javascript#25384))
- ci: Share the E2E test setup between build.yml and optional-e2e.yml ([#25616](getsentry/sentry-javascript#25616))
- ci: Stop uploading duplicate tarballs to the release artifact ([#25688](getsentry/sentry-javascript#25688))
- ci(cloudflare): Run the integration tests on the latest wrangler too ([#25508](getsentry/sentry-javascript#25508))
- ci(e2e): Run all E2E tests when CI config changes ([#25391](getsentry/sentry-javascript#25391))
- ci(e2e): Run E2E tests with pnpm 12 ([#25334](getsentry/sentry-javascript#25334))
- ci(e2e): Run E2E tests without restoring the monorepo's node_modules ([#25403](getsentry/sentry-javascript#25403))
- ci(e2e): Stop pnpm run from installing the workspace in E2E jobs ([#25514](getsentry/sentry-javascript#25514))
- ci(size-limit): Don't enforce size limits on release PRs ([#25631](getsentry/sentry-javascript#25631))
- docs: Add guide for testing SDK packages with pnpm link ([#25512](getsentry/sentry-javascript#25512))
- feat(deps): Bump [@actions/glob](https://github.com/actions/glob) from 0.6.1 to 0.7.0 ([#25411](getsentry/sentry-javascript#25411))
- feat(deps): Bump [@anthropic-ai/sdk](https://github.com/anthropic-ai/sdk) from 0.63.0 to 0.133.0 ([#25417](getsentry/sentry-javascript#25417))
- feat(deps): Bump recast from 0.20.5 to 0.24.0 ([#25416](getsentry/sentry-javascript#25416))
- ref(core): Share the commit env var list used for release detection ([#25478](getsentry/sentry-javascript#25478))
- test(browser): Use blocking scripts in loader integration tests ([#25395](getsentry/sentry-javascript#25395))
- test(deps): Upgrade TanStack Start, Router, and Nitro ([#25445](getsentry/sentry-javascript#25445))
- test(e2e): Add node-otel-sdk-node-v3 e2e app for OpenTelemetry JS v3 ([#25630](getsentry/sentry-javascript#25630))
- test(e2e): Align Playwright versions with the root version ([#25381](getsentry/sentry-javascript#25381))
- test(e2e): Cover Vercel AI decisions in node-openai-decisions-send-to-sentry ([#25458](getsentry/sentry-javascript#25458))
- test(e2e): Drop OpenRouter's \[DONE] frame in the Anthropic test app ([#25594](getsentry/sentry-javascript#25594))
- test(e2e): Drop unused [@sentry/bundler-plugins](https://github.com/sentry/bundler-plugins) dependency from bundler apps ([#25399](getsentry/sentry-javascript#25399))
- test(e2e): Fix peer dependency issues in hydrogen-react-router-7 ([#25400](getsentry/sentry-javascript#25400))
- test(e2e): Install test-utils from a tarball ([#25402](getsentry/sentry-javascript#25402))
- test(e2e): Move app port 38787 out of the ephemeral port range ([#25504](getsentry/sentry-javascript#25504))
- test(e2e): Remove event dumps and their normalization script ([#25404](getsentry/sentry-javascript#25404))
- test(e2e): Retry tests in all dev-mode variants ([#25640](getsentry/sentry-javascript#25640))
- test(e2e): Use nitro beta and Vite 8 in tanstackstart apps ([#25451](getsentry/sentry-javascript#25451))
- test(nestjs): Fix flaky schedule instrumentation error tests ([#25447](getsentry/sentry-javascript#25447))
- test(nextjs): Bump nextjs-16 E2E app to Next.js 16.4.2 ([#25686](getsentry/sentry-javascript#25686))
- test(nextjs): Fix flaky nextjs-16 metrics tests ([#25517](getsentry/sentry-javascript#25517))
- test(nextjs): Use React 19.3.1 in the vinext e2e variants ([#25449](getsentry/sentry-javascript#25449))
- test(nextjs): Warm the module graph before the tunnel route tests ([#25593](getsentry/sentry-javascript#25593))
- test(node): skip the Prisma 8 suite on Node 20 ([#25421](getsentry/sentry-javascript#25421))
- test(nuxt): Pin the nuxt-4 e2e MongoDB image to 8.0 ([#25557](getsentry/sentry-javascript#25557))
- test(nuxt): Pin the nuxt-5 e2e MongoDB image to 8.0 ([#25564](getsentry/sentry-javascript#25564))
- test(nuxt): Wait for hydration before clicking in error tests ([#25520](getsentry/sentry-javascript#25520))
- test(react): Fix flaky react-router-6 aborted SSE console assertion ([#25398](getsentry/sentry-javascript#25398))
- test(replay): Fix flaky bufferStalledRequests segmentId assertion ([#25394](getsentry/sentry-javascript#25394))

</details>

Work in this release was contributed by [@4ktLuffy](https://github.com/4ktLuffy), [@adityareddy-dev](https://github.com/adityareddy-dev), [@dasilvaluis](https://github.com/dasilvaluis), [@faizansaiyed123](https://github.com/faizansaiyed123), [@jpdefo](https://github.com/jpdefo), [@Jxxunnn](https://github.com/Jxxunnn), [@mikamikasuki](https://github.com/mikamikasuki), [@philipatkinson](https://github.com/philipatkinson), [@rubas](https://github.com/rubas), and [@Shubham-Padkonde](https://github.com/Shubham-Padkonde). Thank you for your contributions!

- **feat(bun): Add incoming request options and request sessions to `bunServerIntegration`**

  `bunServerIntegration` now accepts the same options as `denoServeIntegration`: `ignoreRequestBody`, `ignoreIncomingRequests`, `ignoreStaticAssets`, `spans`, `onSpanCreated`, `onSpanEnd`, `sessions` and `sessionFlushingDelayMS`. The callbacks receive the web `Request`.

  `Bun.serve` now records a request session for each incoming request. Sessions are sent only when a `release` is set. To turn them off, set `bunServerIntegration({ sessions: false })`.

  `ignoreStaticAssets` defaults to `true`, so `Bun.serve` no longer creates spans for `GET` requests to common static assets such as `favicon.ico`, `robots.txt` or `*.js` files. To keep these spans, set `bunServerIntegration({ ignoreStaticAssets: false })`. `Bun.serve` spans also follow the client's tracing configuration by default, so the integration does not start spans when tracing is disabled. Errors thrown for `OPTIONS` and `HEAD` requests are now captured.

- **feat(node): Add `onSpanEnd` to `httpIntegration`**

  `httpIntegration` and `httpServerSpansIntegration` now accept `onSpanEnd`, a hook that runs when the response for an incoming request finishes, before its span ends. Use it to change the span based on the response. Deno and Bun already have this option.

- **feat(bun): Inject debug IDs and upload source maps in `sentryBunPlugin` ([#25670](getsentry/sentry-javascript#25670

  `sentryBunPlugin` from `@sentry/bun/plugin` now accepts the same options as `sentryEsbuildPlugin` (`org`, `project`, `authToken`, `release`, `sourcemaps`, ...). When `Bun.build` writes source maps to `outdir`, the plugin injects the debug ID that Bun writes into each bundle, injects the release, and uploads the source maps at the end of the build. You no longer need to run `sentry sourcemap inject` and `sentry sourcemap upload` after the build.

  Like the other bundler plugins, `sentryBunPlugin` now sends build telemetry and injects the release it detects (for example, from git). To turn off telemetry, set `telemetry: false`.
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.

4 participants