Repository navigation
feat(sourcemap): Add wasm sourcemap support for inject and upload - #1629
Open
sentry-junior[bot] wants to merge 6 commits into
Open
sentry-junior[bot] wants to merge 6 commits into
sentry-junior[bot] wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sentry-junior
Bot
force-pushed
the
port/cli-1588-wasm-sourcemaps
branch
from
October 23, 2026 13:39
a3b4624 to
9a44113
Compare
sentry-junior
Bot
force-pushed
the
port/cli-1588-wasm-sourcemaps
branch
from
October 23, 2026 14:03
9a44113 to
39c9a29
Compare
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
getsentry#1630) ## Summary Angular 22.1 emits debug IDs in JavaScript comments and source maps without Sentry's runtime registration snippet. The CLI treated those IDs as proof of completed injection, leaving the bundle unable to register its ID at runtime. Preserve the existing ID and inject the missing snippet, adjusting source map mappings once. Apply the same decision to external and inline maps, automatic injection during upload, and dry-run reporting. Already registered bundles, including legacy CLI snippets, remain byte-identical; binary bundles with existing IDs and metadata-only build injection retain their existing behavior. Fixes getsentry#1629. ## Test plan - 157 tests passed across nine related sourcemap, build-injection, and binary-detection test files. The new missing-registration cases fail against the original implementation. - Built the Angular reproduction from the issue and ran the CLI: the original implementation reported zero modified files and no runtime snippet; the fix adds one snippet with the same UUID and shifts mappings once. A second run leaves both files byte-identical. - Lint, typecheck, docs fragment checks, and `git diff --check` passed. Generated docs and SDK prerequisites produced no tracked generated changes. - Not run: live upload, browser event ingestion, native binary build, or the full unit suite.
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
getsentry#1630) ## Summary Angular 22.1 emits debug IDs in JavaScript comments and source maps without Sentry's runtime registration snippet. The CLI treated those IDs as proof of completed injection, leaving the bundle unable to register its ID at runtime. Preserve the existing ID and inject the missing snippet, adjusting source map mappings once. Apply the same decision to external and inline maps, automatic injection during upload, and dry-run reporting. Already registered bundles, including legacy CLI snippets, remain byte-identical; binary bundles with existing IDs and metadata-only build injection retain their existing behavior. Fixes getsentry#1629. ## Test plan - 157 tests passed across nine related sourcemap, build-injection, and binary-detection test files. The new missing-registration cases fail against the original implementation. - Built the Angular reproduction from the issue and ran the CLI: the original implementation reported zero modified files and no runtime snippet; the fix adds one snippet with the same UUID and shifts mappings once. A second run leaves both files byte-identical. - Lint, typecheck, docs fragment checks, and `git diff --check` passed. Generated docs and SDK prerequisites produced no tracked generated changes. - Not run: live upload, browser event ingestion, native binary build, or the full unit suite.
BYK
marked this pull request as ready for review
November 16, 2026 23:03
4 of 21 tasks
Ported from getsentry/cli#1588 by @d2anamaria. `sourcemap inject` and `sourcemap upload` now handle `<stem>.wasm` + `<stem>.wasm.map` pairs: the map takes the module's `build_id` as its debug ID, and a module without one is stamped first. Rebased onto the refreshed wasm-upload branch as one commit. It folds in the earlier commits on this branch: - feat(sourcemap): Add wasm sourcemap support for inject and upload - fix(sourcemap): Skip unusable wasm pairs instead of failing the run - test(sourcemap): Name wasm-upload companions the way it writes them - fix(sourcemap): Explain wasm pairing when modules and maps don't match Option types now accept explicit `undefined`, and tests use index access on parsed maps, for main's exactOptionalPropertyTypes and noPropertyAccessFromIndexSignature. Refs getsentry/cli#1588 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Discovery skips files matched by --ignore / --ignore-file, but the diagnostic that explains an empty result still counted them. Ignoring every .wasm next to a valid pair reported "none pair up", and ignoring every JS file reported JS files without maps. Both diagnostic walks now apply the same matcher, so the .wasm.map count still lines up with the JS tally it is subtracted from. Also pins the --dry-run report for wasm pairs: a pair a real run would stamp shows as modified, with its debug ID or (pending). Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
port/cli-1588-wasm-sourcemaps
branch
from
November 26, 2026 11:16
4225ea9 to
cbf136c
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cbf136c. Configure here.
A wasm-only directory whose pairs all had to be skipped (a .wasm that isn't a module, a broken map) still asked for credentials and uploaded an empty bundle. Pairs are now checked read-only first, so that case fails like an empty directory, or is a no-op with --allow-empty. A map that parses but isn't a sourcemap object, such as [] or null, threw a TypeError after the module was stamped. It is now rejected before anything is written. If the map write itself fails after the module got its build_id, the skip says so instead of claiming nothing was written. Co-Authored-By: BYK <burak.kaya@sentry.io> Co-Authored-By: bete <miguel.betegon@sentry.io>
Brings in main via the base branch. Resolve the conflicts in sourcemap/upload.ts and its test: adopt main's multi-prefix PathStrip and stripPath for every URL, so urlRelativePath now strips with it for both JS and wasm files. Wasm pairs still join the --strip-common-prefix computation and the artifact list, which replaces the branch's resolvePathPrefixToStrip helper. Main's sources stripping runs over every source_map artifact, so it covers wasm maps too. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Brings in main via the base branch. Resolve the conflict in sourcemap/upload.ts: with --allow-empty and a missing directory, skip wasm pair discovery the same way main now skips JS pair discovery. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This branch was successfully 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.

Ported from getsentry/cli#1588 by @d2anamaria, which is being closed as part of the
getsentry/cliarchive. This PR is stacked on #1628 (the port of cli#1572) and should merge after it; retarget it tomainonce #1628 lands.Problem
sentry sourcemap injectandsentry sourcemap uploadonly look for.js,.cjs, and.mjsfiles. When Emscripten builds with-gsource-map, it writes anapp.wasm.mapfile, and these commands never upload it. Even when the map gets to Sentry some other way, nothing links it to its module. Events identify a wasm module by itsbuild_idcustom section, but uploaded sourcemaps are matched by thedebug_idinside the map JSON.Solution
Both commands now handle
<stem>.wasm+<stem>.wasm.mappairs next to JavaScript pairs.build_iddecides the id. The CLI formats it as a dashed UUID and writes it into the map asdebug_id/debugId.build_idgets a random one first.uploadsends the module asminified_sourceand the map assource_map, both under the same id.--url-prefix,--strip-prefix,--strip-common-prefix,--release, and--distall work for these pairs.*.debug.wasmcompanions are skipped, becausedebug-files wasm-uploaduploads them.Build-id stamping moves to
lib/wasm/stamp.ts, sowasm-uploadand the sourcemap path follow the same rule.Relation to #2502
#2502 uploads the same
<module>.wasm.mapthroughdebug-files uploadas awasmsourcemapdebug file. Both ship: this PR serves the artifact-bundle path, #2502 the debug-file path that Symbolicator will read. They key the map the same way: the CLI'sbuild_iddecoding here gives the same debug ID that@sentry/symbolic14.0.0-alpha.5 (used bydebug-files upload) reports, and thedebugIdthis PR writes into the map is the id getsentry/sentry#132523 stores the map under. Runningsourcemap injectfirst also gives a module without abuild_idthe id that #2502 needs to pair its map.Port notes
--strip-common-prefixstill handles inline maps.setSourcemapDebugIdcalls toolkit'smutateSourcemapwithoutsnippetLine, somappingsare not shifted. In the original PR this was theoffsetMappings: falseoption.--dry-run, wasm pairs showed as unchanged even when the command would stamp them.mapWrittenandmoduleStampednow report what a real run would do, asinjecteddoes for JS.--ignore/--ignore-file, so ignoring every.wasmnext to a valid pair reported "none pair up". Both diagnostic walks (JS and wasm) now apply the same matcher, which keeps the.wasm.mapcount in line with the JS tally it is subtracted from. The JS-only message on main had the same miscount and is fixed with it.sentry sourcemap upload './dist/**') narrows wasm pairs the same way it narrows JS pairs. A pair is kept when the module or its map matches.sourceMappingURLsection is not parsed.sentry-cli v3 compatibility
sourcemaps uploadincludesmapin its default extensions, so it uploadedapp.wasm.mapby URL. v4 on main drops it. This PR brings it back, paired with the module..wasmfiles fromsourcemaps inject/upload. This PR stamps abuild_idinto modules that have none.--no-rewritekeeps the v3 behavior: nothing is written, and the pair uploads by URL with whatever id the module already has.build_idconvention (getsentry/symbolic#1069)The map is keyed by the convention-correct id, decoded from the
build_idvector. The other readers now agree:@sentry/wasmsince fix(wasm): Skip length prefix in 16-byte build IDs sentry-javascript#24857 (11.11.0)Caveats:
@sentry/wasm11.12.0 strips the length byte only from 16-byte ids. Modules linked withwasm-ld --build-id=sha1(20 bytes) still report a shifted id, and that has to be fixed in the SDK.Review fixes
build_id(written before the length prefix was standardized) is read as is, matching symbolic. Before, such a module got a second, randombuild_id, and symbolic and the SDK then read different ones. The fix is in feat(debug-files): Add wasm-upload command for WASM debug setup #1628 (lib/wasm/binary.ts)..wasmthat isn't a module, a map that isn't JSON, an unreadablebuild_id, or files that can't be written. Before, it threw after the JS files had already been rewritten. The map is checked before the module is stamped, so a skipped pair writes nothing.build_idtoo short to form a debug ID produces a warning.rename, so an interrupted write can't leave a corrupt artifact.Refs getsentry/cli#1588
via BYK, @betegon, @BYK.
--
View Session [Sentry]