-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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/browser
SDK Version
10.32.1
Framework Version
@sentry/vite-plugin 4.6.1, @sentry/wasm 10.32.1
Link to Sentry event
https://medmunds.sentry.io/issues/7165204471/events/417ba7d770ad47b998e9455a9915f024/
Reproduction Example/SDK Setup
import * as Sentry from "@sentry/browser";
import { wasmIntegration } from "@sentry/wasm";
Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN,
sendDefaultPii: false,
integrations: [
Sentry.browserTracingIntegration(),
wasmIntegration(), // optional, to see the wasm issue
Sentry.thirdPartyErrorFilterIntegration({
filterKeys: [import.meta.env.VITE_SENTRY_FILTER_APPLICATION_ID],
behaviour: "apply-tag-if-contains-third-party-frames",
}),
],
});
// then in the module that creates workers...
const sentryWebWorkerIntegration = Sentry.webWorkerIntegration({ worker: [] });
Sentry.addIntegration(sentryWebWorkerIntegration);
// and when a worker is created...
const worker = new Worker(new URL("./worker.ts", import.meta.url), {...});
sentryWebWorkerIntegration.addWorker(worker);
// and in worker.ts...
import * as Sentry from "@sentry/browser";
Sentry.registerWebWorker({ self });(I'd be happy to extract a minimal reproducible project if this is a bug that's likely to be fixed. You can see the actual code I'm running here: Sentry.init (includes a project-specific workaround for this issue), webWorkerIntegration, addWorker, registerWebWorker.)
Steps to Reproduce
- Create a project that uses Sentry.thirdPartyErrorFilterIntegration (with vite and @sentry/vite-plugin to add the applicationKey), web workers with Sentry.webWorkerIntegration, and (optionally) web assembly with @sentry/wasm wasmIntegration (loaded through vite's static asset management).
- Throw an error in the web worker (or in the wasm code)
- Examine the recorded event
Expected Result
Since all of the code involved is first-party, the event should not be tagged third_party_code.
Actual Result
The event incorrectly includes tag third_party_code: true.
Here's an example stack. Debugging thirdPartyErrorFilterIntegration in Chrome, it identified the frames for both worker.ts and slide-BhXf1bBR.wasm as third-party:
RuntimeError: Aborted(Assertion failed: !"We shouldn't get here", at: /puzzles/unfinished/slide.c,711,generate_board). Build with -sASSERTIONS for more info.
at abort (../src/assets/puzzles/emcc-runtime.js:1:2243)
at ___assert_fail (../src/assets/puzzles/emcc-runtime.js:1:6101)
0x24cac null (/assets/slide-BhXf1bBR.wasm)
0x15224 null (/assets/slide-BhXf1bBR.wasm)
0x17a2b null (/assets/slide-BhXf1bBR.wasm)
0x0dcba null (/assets/slide-BhXf1bBR.wasm)
at createJsInvoker (../src/assets/puzzles/emcc-runtime.js:1:32024)
at WorkerPuzzle.newGame (../src/puzzle/worker.ts:135:19)
at callback (../node_modules/comlink/dist/esm/comlink.mjs:103:48)
Additional Context
For web worker code:
- sentryVitePlugin doesn't seem to add Sentry's metadata to worker modules
- even if it did, that metadata would end up in
_sentryModuleMetadatain the worker thread global, not the main thread global, so thirdPartyFilterIntegration in the main thread wouldn't find it (related: webWorkerIntegration: breadcrumbs/tags/context set in worker thread get lostΒ #18704)
For wasm code, I suspect there isn't really any way for sentryVitePlugin to inject Sentry's metadata the way it does for JS. Perhaps there could be some way for the app to tell thirdPartyErrorFilterIntegration about additional first-party code at runtime? (A new registerFirstPartyModule(url: URL | string) API?)
(I'm using vite 7.3.0.)
Priority
React with π to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
Status