Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/wasm
SDK Version
8.26.0
Framework Version
No response
Link to Sentry event
Reproduction Example/SDK Setup
I wasn't able to make minimal example showcasing the problem, as I was not able to find a way to use wasmIntegration
using loader/CDN setup (In my app I'm integrating @sentry/wasm
via npm). I'll happily update this if pointed to possible solution/workaround.
In order to run the example you need to install Emscripten SDK for compiling c++ code to wasm.
index.html
:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script>
window.sentryOnLoad = function () {
Sentry.init({
dsn: '…',
release: 'develop',
attachStacktrace: true,
// FOLLOWING LINE BREAKS THE EXAMPLE DUE TO MISSING WASM INTEGRATION IN LOADED SENTRY SCRIPT
integrations: [wasmIntegration()],
beforeSend(event, hint) {
return event
}
});
};
</script>
<script src="https://js.sentry-cdn.com/USE_YOUR_LINK.min.js" crossorigin="anonymous"></script>
<!-- Add the javascript glue code (index.js) as generated by Emscripten -->
<script src="index.js"></script>
</body>
</html>
main.cpp
:
#include <stdexcept>
int main() {
// abort(); <-- this would work just fine - Sentry's wasmIntegration would properly process event
throw std::runtime_error("exception from wasm/c++"); // this is not handled by Sentry's wasmIntegration
return 0;
}
Steps to Reproduce
- Create
index.html
andmain.cpp
files as listed above in the same directory - Compile c++ file using Emscripten:
emcc -fwasm-exceptions -sEXCEPTION_STACK_TRACES=1 -Oz -g3 main.cpp -o index.js
- Run HTTP server (I'm using
python3 -m http.server
) and openindex.html
in the browser (http://localhost:8000 in my case).
Expected Result
Reported event should be recognised as Wasm event and should have stack trace showing stack trace when exception was thrown. This would allow proper symbolication and event grouping.
Actual Result
Reported event is recognised as regular JS event and has wrong stack trace. Stack trace has only JS frames for state completely not related to wasm/c++ exception.
Note that following shows results for my real app that integrates with sentry via npm
When using DevTools to see what event is provided to beforeSend
hook, I see that event.exception.values
has:
- single entry with
stacktrace
not related to actual exception - proper (meaning: desired for reporting) stack trace is available in
value.stack
(please note that value isWebAssembly.Exception
).
Wasm integration is not processing such event because of exception's stacktrace
not containing any wasm frame source.
Above scenario differs from wasm crash (not exception) that is properly processed by Sentry's wasm integration and thus properly seen from Sentry's UI. Following is example of event
contents seen from beforeSend
in crashing scenario (see comment in main.cpp
to try yourself):
Metadata
Metadata
Assignees
Labels
Type
Projects
Status