getsentry / getsentry/sentry-javascript
Elysia on Node reports `runtime: {name: 'bun', version: 'unknown'}`
- 主要语言
- TypeScript
- 星标
- 8.7k
- 派生
- 1.8k
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 523
描述
`elysia/src/sdk.ts:46` sets `runtime: getRuntime()`, which correctly returns `{name:'node'}` off Bun. Then `bun/src/sdk.ts:145` spreads the user options and overwrites `runtime` with its own hard-coded Bun value. Every Elysia-on-Node event is attributed to the wrong runtime. There is an `elysia-node` e2e app, so this configuration is supported.
**Work item** Make `bun/src/sdk.ts:148` respect a caller-supplied `runtime` (only default it when absent), matching `packages/node/src/sdk/client.ts:47`. Assert both runtimes in the Bun tests, and again in the Elysia tests.
**Prior art**: [#19269]() is the same bug one layer up: "`NodeClient` always overrides runtime context to 'node', ignoring Bun SDK's runtime option". It was fixed by making `NodeClient` respect a caller-supplied value, which is now `packages/node/src/sdk/client.ts:47`:
```ts
runtime: options.runtime || { name: 'node', version: global.process.version },
```
`packages/bun/src/sdk.ts:145` still does the unconditional override that #19269 removed from `NodeClient`, so any SDK wrapping `@sentry/bun` hits it. Apply the same one-line remedy there.
贡献指南
调研方向
从 packages/bun/src/sdk.ts:145-148 开始,并将其运行时处理与 packages/node/src/sdk/client.ts:47 进行比较。更新 Bun 测试和 elysia-node e2e 测试,以断言这两个运行时值,包括调用方提供的运行时。完成标准是:Elysia 在 Node 上报告 Node,而 Bun 仍然报告 Bun。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 88/100