getsentry / getsentry/sentry-javascript
bun: Channel injection is unavailable under `bun run`, and only a debug log says so
- Langage dominant
- TypeScript
- Étoiles
- 8.7k
- Forks
- 1.8k
- Merge moyen
- 1 j 17 h
- PR mergées (30 j)
- 523
Description
`registerDiagnosticsChannelInjection` takes its fallback branch on Bun. `Module.registerHooks` is `undefined` in bun 1.3.14, and the `Module.register` branch is explicitly gated on `!globalAny.Bun` (`packages/server-utils/src/orchestrion/runtime/register.ts:126`).
```
$ bun run init-probe.mjs
ORCHESTRION MARKER: {"runtimeUnavailable":true}
INTEGRATIONS: 42 ... Graphql,Mongo,Mongoose,Mysql,Mysql2,Redis,Postgres,
Prisma,Tedious,GenericPool,Kafka,Amqplib,LruMemoizer,Aws,LangChain,LangGraph,
VercelAI,OpenAI,Anthropic_AI,Google_GenAI,PostgresJs,Firebase
Sentry Logger [warn]: [Sentry] No diagnostics-channel injection detected...
```
Twenty-two channel integrations report `Integration installed` and then never fire. The only signal is `debug.warn` inside `detectOrchestrionSetup`, which is off unless the user sets `debug: true`.
Note that these integrations also handle error capture, not only spans, so a Bun user running `bun run` loses Express/Fastify/Koa/Hapi error capture too.
**Work item.** Promote the "no injection detected" message to an always-on `consoleSandbox` warning on Bun (matching `warnRuntimeUnavailable`, which already exists for the failure path), and name the fix: build with `@sentry/bun/plugin`. Keep it debug-only on Node, where the runtime hook normally succeeds.
**Prior art ***(tracked)*. Two open issues describe the symptom without naming the cause: [#14202]() (open since 2024-11) "Integrations not working for Bun", and [#17779]() (open). [#19696]() (closed) "None of the AI auto-instrumentations work with Sentry Bun" is the same report for the AI integrations. The build-time fix shipped in getsentry/sentry-javascript#21410 (merged, the Bun build plugin). There is precedent for the always-on warning proposed here: getsentry/sentry-javascript#22379 (merged) warns when a bundler config externalizes an instrumented module. No issue covers promoting this particular warning.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez dans packages/server-utils/src/orchestrion/runtime/register.ts autour de la ligne 126 et suivez detectOrchestrionSetup, registerDiagnosticsChannelInjection ainsi que le chemin warnRuntimeUnavailable existant. Rendez l’avertissement de non-injection de Bun toujours actif via consoleSandbox, indiquez @sentry/bun/plugin comme correctif et préservez le comportement réservé au débogage sur Node.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- bun, typescript
- Domaine
- backend, observability
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Active
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 84/100