fix: Drop frameless third-party errors from global handler#18342
fix: Drop frameless third-party errors from global handler#18342sentry[bot] wants to merge 1 commit into
Conversation
Add a beforeSend filter to the client-side Sentry init that drops error events with no stack frames captured by the global onerror or onunhandledrejection handlers. These frameless errors originate from browser extensions or third-party scripts injected into the page and have no app context, producing noise in the Sentry project. The existing thirdPartyErrorFilterIntegration only handles errors whose frames are all marked as third-party. Errors with zero frames bypass that check entirely, so this beforeSend guard covers the gap. Fixes DOCS-AVV
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c46fa04. Configure here.
| const noFrames = !frames || frames.length === 0; | ||
| const mechanism = ex.mechanism; | ||
| const isGlobalHandler = | ||
| mechanism?.type === 'onerror' || mechanism?.type === 'onunhandledrejection'; |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit c46fa04. Configure here.


DESCRIBE YOUR PR
Adds a
beforeSendfilter to the client-side Sentry configuration that drops error events with no stack frames captured by the globalonerrororonunhandledrejectionhandlers.Problem
Third-party scripts and browser extensions running on docs.sentry.io throw errors (e.g.
Error: he) that get captured by Sentry's global error handler. These errors have:onerror/onunhandledrejection)The existing
thirdPartyErrorFilterIntegrationonly filters errors whose frames are all marked as third-party. Errors with zero frames bypass that check entirely.Fix
A
beforeSendhook checks whether every exception value in the event:stacktrace.frames)mechanism.typeisonerrororonunhandledrejection)If both conditions hold for all exception values, the event is dropped (
return null).Fixes DOCS-AVV
IS YOUR CHANGE URGENT?
PRE-MERGE CHECKLIST