Skip to content

Commit 49160dc

Browse files
committed
fix: address review feedback
- Fix BunClient → LightNodeClient type in telemetry-session test - Remove dead empty alias object from esbuild config - Override LightNodeClient runtime metadata to report bun when running as a compiled Bun binary (the client hardcodes 'node')
1 parent f5a2043 commit 49160dc

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

script/bundle.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ const result = await build({
8989
entryPoints: ["./src/bin.ts"],
9090
bundle: true,
9191
minify: true,
92-
alias: {},
9392
banner: {
9493
// Check Node.js version (>= 22 required for node:sqlite) and suppress warnings
9594
js: `#!/usr/bin/env node

src/lib/telemetry.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ export function initSentry(
338338
const isBun = typeof process.versions.bun !== "undefined";
339339
const runtime = isBun ? "bun" : "node";
340340

341+
// LightNodeClient hardcodes runtime to { name: 'node' }. Override it so
342+
// events carry the correct runtime when running as a compiled Bun binary.
343+
const opts = client.getOptions();
344+
opts.runtime = {
345+
name: runtime,
346+
version: isBun ? process.versions.bun : process.version,
347+
};
348+
341349
// Tag whether running as bun binary or node (npm package).
342350
// Kept alongside the SDK's promoted 'runtime' tag for explicit signaling
343351
// and backward compatibility with existing dashboards/alerts.

test/lib/telemetry-session.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import {
2121

2222
describe("createBeforeExitHandler", () => {
2323
/**
24-
* Create a minimal mock BunClient for testing the beforeExit handler.
24+
* Create a minimal mock LightNodeClient for testing the beforeExit handler.
2525
* Only needs flush() since that's all the handler uses from the client.
2626
*/
27-
function createMockClient(): Sentry.BunClient {
27+
function createMockClient(): Sentry.LightNodeClient {
2828
return {
2929
flush: () => Promise.resolve(true),
30-
} as unknown as Sentry.BunClient;
30+
} as unknown as Sentry.LightNodeClient;
3131
}
3232

3333
test("ends OK session on beforeExit", () => {

0 commit comments

Comments
 (0)