Repository navigation
fix(cli): Handle Bun debug IDs and // @bun pragma in sourcemap inject - #1515
Merged
Merged
Conversation
`sentry sourcemap inject` mishandled `bun build --target=bun` output: - Bun writes debug IDs as 32 uppercase hex chars without dashes. Only the hyphenated form was recognized, so a second, conflicting debug ID was minted and appended, and Bun's ID in the sourcemap was replaced. Both forms are now accepted from the JS comment and the sourcemap and normalized to the canonical lowercase hyphenated UUID. - The runtime snippet was prepended above Bun's `// @bun` pragma, which Bun only honors at the top of the file (after an optional hashbang). CJS bundles silently stopped running and ESM bundles were re-transpiled on every start. The pragma line now stays above the snippet, and the sourcemap gains its empty line at the snippet's position instead of always at the top. Fixes #1513 Fixes #1514 Co-Authored-By: Burak Yigit Kaya <burak.kaya@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Oct 15, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sentry sourcemap injectbroke onbun build --target=bunoutput in two ways. Both bugs are in the same snippet-insertion path, so they're fixed together.Bun debug IDs weren't recognized (#1513). Bun writes
//# debugId=and the sourcemap'sdebugIdas 32 uppercase hex characters with no dashes. We only matched the hyphenated form, so we minted a second, conflicting ID, appended a second//# debugId=comment, and overwrote Bun's ID in the map. Now both forms are accepted from the JS comment and the sourcemap and normalized to the canonical lowercase hyphenated UUID. That is the ID the snippet registers, the map carries, and the upload uses. Bun's original comment is left alone, and no second comment is added. The runtime-registration check compares normalized IDs too, so a re-run is still a no-op.The snippet landed above Bun's pragma (#1514). Bun only honors
// @bun/// @bun @bun-cjsat the very top of the file, or right after a hashbang (has_bun_pragma). Prepending the snippet above it made CJS bundles silently do nothing and exit 0, and made Bun re-transpile ESM bundles on every start. The pragma line now stays above the snippet, handled the same way as the hashbang. The sourcemap's empty line goes in at the snippet's actual position, not always at line 0. For a header with no mappings, the output is the same as before.One behavior change for existing users: a pre-existing debug ID in uppercase hyphenated form is now reported and re-emitted in lowercase. It's the same UUID.
I checked this end to end with Bun 1.4.3 using the reproductions from both issues. On
main: two conflicting debug IDs, and the CJS bundle prints nothing. With this change: one ID (Bun's, canonicalized), both CJS and ESM bundles run, and a secondinjectleaves the files byte-identical.Fixes #1513
Fixes #1514
via byk.
--
View Junior Session [Sentry]