Skip to content

@sentry/bun - Bun compile fails with --bytecode build flag #21256

@SolarLabyrinth

Description

@SolarLabyrinth

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/bun

SDK Version

10.55.0

Framework Version

Bun 1.3.14

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/SolarLabyrinth/sentry-bun-bytecode-repro

main.ts

import * as Sentry from "@sentry/bun";

Sentry.init({
  dsn: "https://example@example.com/1",
  tracesSampleRate: 0,
});

console.log("Success!");

Steps to Reproduce

Steps to Reproduce Failure:
Fails with v10.54.0 and v10.55.0

bun i @sentry/bun@10.55.0
bun build main.ts --compile --format=esm --bytecode --outfile main
./main

This build fine with previous versions:

bun i @sentry/bun@10.53.1
bun build main.ts --compile --format=esm --bytecode --outfile main
./main

This also builds fine without --bytecode:

bun i @sentry/bun@10.55.0
bun build main.ts --compile --format=esm --outfile main
./main

Expected Result

Success!

Actual Result

17582 |   name;
17583 |   supportedVersions;
17584 |   patch;
17585 |   unpatch;
17586 |   constructor(name, supportedVersions, patch, unpatch) {
17587 |     this.name = normalize4(name);
                                  ^
ReferenceError: normalize4 is not defined
      at new InstrumentationNodeModuleFile (/$bunfs/root/main:17587:27)
      at _addPatchingExecute (/$bunfs/root/main:24491:45)
      at init (/$bunfs/root/main:24485:47)
      at new InstrumentationBase (/$bunfs/root/main:17340:28)
      at new GraphQLInstrumentation (/$bunfs/root/main:24478:10)
      at /$bunfs/root/main:20532:53
      at setupOnce (/$bunfs/root/main:24755:24)
      at setupIntegration (/$bunfs/root/main:8502:26)
      at /$bunfs/root/main:8483:23
      at forEach (native:1:11)

Additional Context

Tested with bun on linux.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions