Repository navigation
@sentry/wasm: wasm://wasm/ frames miss debug_meta on non-streaming instantiate(buffer) #23781
Description
Activity
Traced this through
packages/wasm/src/— can confirm the root cause precisely, one level more specific than the "streaming regex matches first" framing above.The actual gap:
patchWebAssembly()(patchWebAssembly.ts) only wrapsWebAssembly.instantiateStreamingandWebAssembly.compileStreaming. It does not wrapWebAssembly.instantiateat all. So for thefetch → arrayBuffer() → WebAssembly.instantiate(buffer)path,registerModule()is never called — the module is never added toregistry.ts'sIMAGESarray in the first place, under any key.patchFrames'sPARSER_REGEXactually parseswasm://wasm/0bee4c4e:wasm-function[1]:0x8cfine (match[1]comes out aswasm://wasm/0bee4c4e) —getImage('wasm://wasm/0bee4c4e')just correctly returns-1because nothing was ever registered.Why there's no obvious fix by just "patching instantiate too": unlike the streaming path, which has
response.urlto register the image under,WebAssembly.instantiate(bufferSource, importObject)has no URL at all — there's no fetch response in the picture. That's exactly why V8 falls back to the syntheticwasm://wasm/<hash>frame identifier: there's no real source URL to report. So even after patchinginstantiateto callWebAssembly.compile(buffer)(to get aModuleand read itsbuild_id/external_debug_infocustom sections) and callingregisterModule(module, <?>), there's no way to register under a key that will deterministically match V8's synthetic per-module hash — which is exactly why the proposed fix's step 2 (map to the sole registered module whencount === 1) is a heuristic, not a lookup, and why the limitation is scoped to single-module registration until there's a real cross-reference between a compiledModuleand its later-generated stack-frame identifier.On implementation, two overload wrinkles worth flagging before writing this:
WebAssembly.instantiatehas two overloads —(bufferSource, importObject?)(compiles and instantiates, needs aWebAssembly.compile()call inserted to get aModulefor reading custom sections) vs.(moduleObject, importObject?)(module already compiled — should probably also register, no extra compile needed). The patch needs to branch onarg instanceof WebAssembly.Module.- Registering under a placeholder/sentinel key (rather than a real URL) needs
getImage's lookup path (viapatchFrames) to specifically recognize thewasm://wasm/frame shape as "look for the sole non-URL-registered image" rather than doing its normal exact-string match — that logic lives inindex.ts, notregistry.ts, so the fix spans both files plus the newpatchWebAssembly.tsinterception.
I don't have a way to compile a real
.wasmbinary withbuild_id/external_debug_infocustom sections and run it through an actual browser (the existing test suite'ssuites/wasm/*tests need a real compiled binary,simple.wasm, and Playwright) to verify an implementation end-to-end in this environment, which is why I'm sharing this as source-level confirmation rather than a PR. Happy to implement it against the plan above (and thesuites/wasm/nonStreaming/test suite you mentioned) if that's a useful next step, or if you already have a WIP branch for this given how precisely-scoped your proposed fix already reads.- moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3
on Sep 1, 2026 - added a commit that references this issue
on Sep 3, 2026 - added a commit that references this issue
on Sep 7, 2026 - added a commit that references this issue
on Sep 25, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Description
Problem
fetch→arrayBuffer()→WebAssembly.instantiate(buffer)can produce frames like:wasm://wasm/0bee4c4e:wasm-function[1]:0x8c(no file URL).Module is registered, but
patchFramesfails: streaming regex matches first,getImage('wasm://wasm/…')misses,debug_meta.imagesnever attached.Works / breaks
instantiateStreaminginstantiate(buffer)when stack hashttp://…/file.wasm:wasm-function[…](Emscripten, dev Rust)instantiate(buffer)+wasm://wasm/…(minimal wasm, e2esimple.wasm)wasm://wasm/<id>not mappable)build_id/ untagged buffer)Proposed fix
wasm://wasm/…before streaming regexpostprocessEventhooksuites/wasm/nonStreaming/Limitation
Single registered wasm module only until multi-module mapping exists.