Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/instrumentation-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ Sentry.init({
Sentry.consoleLoggingIntegration(),
],

// Drop frameless errors caught by the global unhandled error handler.
// These are typically from browser extensions or third-party scripts injected
// into the page — they have no stack frames and no app context.
beforeSend(event) {
const framelessUnhandled =
event.exception?.values?.length &&
event.exception.values.every(ex => {
const frames = ex.stacktrace?.frames;
const noFrames = !frames || frames.length === 0;
const mechanism = ex.mechanism;
const isGlobalHandler =
mechanism?.type === 'onerror' || mechanism?.type === 'onunhandledrejection';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong global handler mechanism types

Medium Severity

The new beforeSend filter treats global-handler captures only when mechanism.type is exactly onerror or onunhandledrejection. With @sentry/browser 10.55.0 (this repo’s lockfile), GlobalHandlers sets types like auto.browser.global_handlers.onerror, so isGlobalHandler stays false and frameless extension noise is still sent.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c46fa04. Configure here.

return noFrames && isGlobalHandler;
});
if (framelessUnhandled) {
return null;
}
return event;
},

// Filter sensitive metric attributes (no PII in metrics)
beforeSendMetric: metric => {
// Remove any accidentally added PII attributes
Expand Down
Loading