Repository navigation
Conversation
Bun 1.4.5 fixes CommonJS modules that a runtime `onLoad` plugin returns (oven-sh/bun#19279). Before, they lost their named exports, so the orchestrion transform could only run in `bun build`. `Sentry.init()` from `@sentry/bun` now registers the orchestrion transform with `Bun.plugin()`. The new `@sentry/bun/import` preload does the same before the app loads, so it also reaches the static imports of the entry module: bun --preload @sentry/bun/import app.ts On older Bun versions the SDK skips the registration, and the warning about missing channel injection tells users to upgrade Bun or build with `@sentry/bun/plugin`. `enableRuntimeChannelInjection: false` turns the registration off, as in `@sentry/node`. The injected snippet imports `@sentry/server-utils` from inside the instrumented package. Under isolated installs that specifier does not resolve from there, so an `onResolve` hook points it at the copy of `@sentry/server-utils` that the SDK already loaded. The new `node-suites-bun-run` integration project runs the auto-instrumentation suites unbuilt on Bun 1.4.5 or later, and CI runs the Bun integration tests on canary too, until 1.4.5 is released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
size-limit report 📦Compared: 16871dc (PR test merge using develop at d44a8ba) Against: d44a8ba (develop) · base run #66610 ✅ Baseline matches: this diff contains only this PR's changes.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ce0dbce. Configure here.
| bun.plugin(sentryOrchestrionPlugin()); | ||
| marker.runtime = []; | ||
| debug.log('[Sentry] Registered diagnostics-channel injection via Bun.plugin()'); | ||
| } |
There was a problem hiding this comment.
Init can crash the host app
High Severity
registerBunRuntimeInstrumentation calls Bun.plugin() and constructs the orchestrion transformer with no try/catch. Node’s registerDiagnosticsChannelInjection wraps the same kind of work because an unguarded throw aborts --import/--preload or makes init() throw. A plugin-setup or transformer failure on Bun 1.4.5+ or canary would brick the host instead of degrading to no channel injection.
Additional Locations (2)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit ce0dbce. Configure here.
| import type { BunOptions } from './types'; | ||
| import { bunHttpServerIntegration } from './integrations/bunHttpServer'; | ||
| import { getErrorIntegrations, getTracingIntegrations } from '@sentry/server-utils'; | ||
| import { registerBunRuntimeInstrumentation } from '@sentry/server-utils/orchestrion/bun'; |
There was a problem hiding this comment.
Runtime pulls in build-time transformer
Medium Severity
@sentry/bun now statically imports @sentry/server-utils/orchestrion/bun, so the orchestrion bundler plugin and its parser stack (meriyah, esquery, astring) load on every SDK import. That happens even on Bun before 1.4.5 and when enableRuntimeChannelInjection is false, where registration is skipped. Node keeps this on @sentry/server-runtime-injection instead of the bundler path. dev-packages/bundler-tests/tests/runtime-entries.test.ts also treats orchestrion/bundler/ as build-time tooling, so @sentry/bun and the new ./import export will fail that test until the runtime hook is split out or the cases are updated.
Additional Locations (2)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit ce0dbce. Configure here.


Bun 1.4.5 fixes CommonJS modules that a runtime
onLoadplugin returns (oven-sh/bun#19279). Before, they lost their named exports, so the orchestrion transform could only run inbun build.Sentry.init()from@sentry/bunnow registers the orchestrion transform withBun.plugin(). The new@sentry/bun/importpreload does the same before the app loads, so it also reaches the static imports of the entry module:On older Bun versions the SDK skips the registration, and the warning about missing channel injection tells users to upgrade Bun or build with
@sentry/bun/plugin.enableRuntimeChannelInjection: falseturns the registration off, as in@sentry/node.The injected snippet imports
@sentry/server-utilsfrom inside the instrumented package. Under isolated installs that specifier does not resolve from there, so anonResolvehook points it at the copy of@sentry/server-utilsthat the SDK already loaded.The new
node-suites-bun-runintegration project runs the auto-instrumentation suites unbuilt on Bun 1.4.5 or later, and CI runs the Bun integration tests on canary too, until 1.4.5 is released.