Commit 660a04b
authored
fix(telemetry): correct runtime context for Bun binary (#231)
## Summary
- Fix incorrect `runtime` tag/context showing `node` instead of `bun`
for native Bun binary
- Override `client.getOptions().runtime` after `Sentry.init()` to work
around `@sentry/bun` v10 bug where `NodeClient` always overrides the
runtime option
- Keep `cli.runtime` tag for backward compatibility with existing
dashboards
## Problem
`@sentry/bun` v10 delegates to `@sentry/node`'s `NodeClient`, which
always overrides `runtime` to `{ name: 'node', version: process.version
}`. Under Bun, `process.version` returns the Node.js compat version
(e.g. `v24.3.0`), causing `event.contexts.runtime` and the
server-promoted `runtime` tag to incorrectly show `node`.
## Fix
Override `client.getOptions().runtime` after `Sentry.init()` with the
correct Bun runtime info. `Sentry.setContext()` doesn't work here
because `ServerRuntimeClient._prepareEvent()` runs before scope context
merging and its result takes precedence.
Upstream issue:
getsentry/sentry-javascript#192691 parent 7c6f815 commit 660a04b
1 file changed
+21
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
169 | 186 | | |
170 | 187 | | |
171 | 188 | | |
| |||
0 commit comments