Skip to content

test(bun): Run the auto-instrumentation suites with bundled scenarios - #24612

Draft
JPeer264 wants to merge 1 commit into
jp/node-suites-bun-sdk-fixesfrom
jp/node-suites-bun-build
Draft

JPeer264 wants to merge 1 commit into
jp/node-suites-bun-sdk-fixesfrom
jp/node-suites-bun-build

Conversation

@JPeer264

Copy link
Copy Markdown
Member

Under bun run the SDK cannot inject diagnostics channels into libraries (JS-3508), so a Bun app only gets framework, database and AI spans when it is built with @sentry/bun/plugin. That path had no integration coverage. The new node-suites-bun-build project bundles each auto-instrumentation scenario with the plugin right before it starts and runs it with @sentry/bun. Express, Fastify, Hapi, Koa, Apollo and most AI suites now run on Bun.

This found 3 SDK bugs, fixed here because the project cannot pass without them:

  • Bun garbage-collects a diagnostics channel that no code references, and its subscribers with it. Node and Deno keep subscribed channels alive. The channel integrations kept no reference, so on Bun they could silently stop producing spans after the first GC. They now keep one.
  • Bun does not publish http.server.request.start (node:http server does not publish to HTTP server diagnostics_channel oven-sh/bun#29586), so @sentry/node created no http.server span on Bun. @sentry/node now uses the Server.prototype.emit patch that @sentry/bun already had, unless bunHttpServerIntegration is installed.
  • nativeNodeFetchIntegration relies on undici's channels, which the fetch of Bun and Deno does not use. On these runtimes it now patches the global fetch. requestHook, responseHook and headersToSpanAttributes receive undici objects, so they are not supported there yet.

The Docker suites are not enabled for Bun yet, because the Bun CI job starts no containers.

Part of JS-3515.

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

JS-3515

@github-actions

github-actions Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.23 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.16 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.16 kB - -
@sentry/browser (incl. Tracing, Replay) 90.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.45 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.42 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.29 kB - -
@sentry/browser (incl. FeedbackAsync) 39.39 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.5 kB - -
@sentry/browser (incl. Metrics & Logs) 31.17 kB - -
@sentry/react 30.98 kB - -
@sentry/react (incl. Tracing) 53.44 kB - -
@sentry/vue 36.72 kB - -
@sentry/vue (incl. Tracing) 53.69 kB - -
@sentry/svelte 29.25 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.19 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.4 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.76 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.5 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.13 kB - -
@sentry/nextjs (client) 55.78 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.92 kB - -
@sentry/core/browser 13.63 kB - -
⛔️ @sentry/node (max: 135 kB) 136.65 kB +2.08% +2.78 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.57 kB +0.21% +172 B 🔺
@sentry/node - without tracing 93.22 kB +3.13% +2.83 kB 🔺
⛔️ @sentry/node - without channel injection (max: 114 kB) 115.1 kB +2.41% +2.7 kB 🔺
@sentry/aws-serverless 101.45 kB +2.81% +2.77 kB 🔺
@sentry/cloudflare (withSentry) - minified 206.38 kB - -
@sentry/cloudflare (withSentry) 513.49 kB - -

View base workflow run

@JPeer264
JPeer264 added this pull request to stack #24613 September 23, 2026 06:14
@JPeer264
JPeer264 force-pushed the jp/node-suites-bun-build branch 2 times, most recently from 99acd71 to 5eb22a2 Compare September 23, 2026 08:11
@JPeer264
JPeer264 force-pushed the jp/node-suites-bun-build branch 2 times, most recently from 48d16a8 to 51be7dc Compare September 23, 2026 09:49
@JPeer264
JPeer264 removed this pull request from stack #24613 September 23, 2026 09:51
@JPeer264
JPeer264 changed the base branch from jp/node-suites-deno to jp/node-suites-bun-sdk-fixes September 23, 2026 09:51
@JPeer264
JPeer264 added this pull request to stack #24633 September 23, 2026 09:51
@JPeer264
JPeer264 force-pushed the jp/node-suites-bun-build branch 2 times, most recently from 9fc4460 to 131b223 Compare September 23, 2026 10:02
Under `bun run` the SDK cannot inject the diagnostics channels into
libraries (JS-3508), so Bun apps must be built with `@sentry/bun/plugin`
to get framework, database and AI spans. The new `node-suites-bun-build`
project tests that path: the runner builds each scenario with the plugin
right before it starts (`RUNTIME_BUILD_SCRIPT`), and runs the bundle
with `@sentry/bun`.

The Docker suites run as well, so the Bun CI job gets the disk space
step of the Node and Deno jobs. `pg-native` and the CommonJS
`postgresjs` tests are skipped on Bun: the `libpq` addon needs a Node
symbol that Bun does not have, and through the `bun` export condition
`require('postgres')` returns the ES module namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/node-suites-bun-build branch from 131b223 to 6c3bef1 Compare September 23, 2026 10:04

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