Repository navigation
feat(cli): Upload WASM source maps next to their modules as debug files - #2502
Sebassmaster wants to merge 1 commit into
Conversation
debug-files upload now queues <module>.wasm.map, when it sits next to a scanned WebAssembly module, as a separate debug file with the module's debug id. Sentry detects the source map from its content and pairs it with the module by that id, so WASM apps can be symbolicated without DWARF. Refs TGDX-154 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Tested end to end against a local Sentry devserver running getsentry/sentry#132523:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
Reviewed for overlap with #1628 (debug-files wasm-upload) and #1629 (WASM source maps in sourcemap inject/upload). @BYK decided to ship both #1629 and this PR, so they need to fit together. They do, with one semantic conflict to fix and a merge dependency.
Semantic conflict with #1628 (whichever lands second must fix it). It merges without textual conflicts, but #1628 moves readSourceFile into debug-files/read-file.ts and drops readFileSync from the node:fs import in debug-files/upload.ts. This PR's appendWasmSourceMap still calls readFileSync, so the merged tree fails to typecheck: upload.ts(240,15): error TS2304: Cannot find name 'readFileSync'. Inline note below.
Overlap with #1629: complementary, not duplicate.
- #1629 uploads
<module>.wasm+<module>.wasm.mapas an artifact bundle (minified_source+source_map) throughsourcemap upload. This PR uploads the same map as awasmsourcemapdebug file throughdebug-files upload. Neither touches the other's files. - They agree on the id.
debug-files uploadtakes the debug ID from@sentry/symbolic14.0.0-alpha.5, and #1629'sbuild_iddecoding gives the same id. #1629 also writes that id into the map asdebugId/debug_id, which getsentry/sentry#132523 prefers over the client id. A map that went throughsourcemap injectfirst lands under the same id either way. - They work well in sequence:
sourcemap inject(#1629) ordebug-files wasm-upload(#1628) stamp abuild_idinto a module that has none, and that's exactly what this PR needs before it can pair the map. - Please drop "This replaces the approach in #1629" from the description, since both ship.
Merge dependency. getsentry/sentry#132523 is still open with changes requested, and its own description says it must wait for getsentry/symbolicator#2229 (also open) to be deployed. So the order is: symbolicator#2229 merged and deployed, then sentry#132523 approved, merged and deployed, then this PR.
On the automatic-default question: the CLI ignores CHUNK_UPLOAD_ACCEPT, and sentry#132523 adds no capability for it anyway, so the CLI can't tell whether a server knows wasmsourcemap. Any server without sentry#132523, including self-hosted installs for a while, will file the map as an il2cpp mapping under the module's debug id. That's worth weighing before making it automatic, or at least worth documenting with a minimum server version.
Non-blocking:
- The help text points to
sentry wasm-splitfor adding a build id. Once #1628/#1629 land,debug-files wasm-uploadandsourcemap injectdo that too. debug-files wasm-upload(#1628) builds its own DIF list, so it won't upload the.wasm.mapthis PR handles. A follow-up could have it reuseappendWasmSourceMap, so the one-step command covers maps too.
| } | ||
| let content: Buffer<ArrayBuffer>; | ||
| try { | ||
| content = readFileSync(mapPath); |
There was a problem hiding this comment.
#1628 drops readFileSync from this file's node:fs import (it moves readSourceFile to ./read-file.ts). Git merges the two cleanly, but the result doesn't compile (TS2304: Cannot find name 'readFileSync'). Whichever PR lands second needs to put readFileSync back in the import.
sentry debug-files uploadnow uploads a WebAssembly module's source map along with the module. When a scanned.wasmhas<module>.wasm.mapnext to it (where Emscripten's-gsource-mapand dart2wasm write it), the map is queued as a separate debug file carrying the module's debug id. Nothing changes for modules without a map.Sentry stores the map as a
wasmsourcemapdebug file next to the module (getsentry/sentry#132523), so Symbolicator can use it to symbolicate WASM frames without DWARF, which keeps compiler optimizations available. The CLI uploads the map as is: Sentry detects the format from the JSON and validates it.The pairing relies on the module's build id. The scanner already skips modules without one, so their maps are never uploaded; the help text points to
sentry wasm-splitto add an id.wasm-splitappends the id after all other sections and copies them byte for byte, so it never shifts the code offsets the map refers to.Until getsentry/sentry#132523 is deployed, Sentry would file an uploaded map as an il2cpp mapping, so this should merge after it.
Question for reviewers: the map is uploaded automatically, with no flag. A map next to its module is unambiguous, and an opt-in flag is easy to forget, which then looks like broken symbolication. The alternative is an opt-in flag like
--il2cpp-mapping(e.g.--wasm-sourcemaps), which keeps the upload set unchanged for existing users. Is automatic the right default?Possible follow-ups, not in this PR:
.wasm.mapis found but its module has no build id, instead of skipping it silently..zip; today only on-disk neighbors are found.This replaces the approach in #1629, which sends WASM source maps through
sourcemap inject/uploadas artifact bundles. Using the debug-file pipeline keeps one pairing key (the build id) for the module and its map.Refs TGDX-154
🤖 Generated with Claude Code