Skip to content

fix: Drop frameless third-party errors from global handler#18342

Closed
sentry[bot] wants to merge 1 commit into
masterfrom
claude/drop-frameless-third-party-errors-87bfb9c7
Closed

fix: Drop frameless third-party errors from global handler#18342
sentry[bot] wants to merge 1 commit into
masterfrom
claude/drop-frameless-third-party-errors-87bfb9c7

Conversation

@sentry

@sentry sentry Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

DESCRIBE YOUR PR

Adds a beforeSend filter to the client-side Sentry configuration that drops error events with no stack frames captured by the global onerror or onunhandledrejection handlers.

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:

  • No stack frames (no app context)
  • An unhandled mechanism (onerror / onunhandledrejection)
  • No relation to docs site code

The existing thirdPartyErrorFilterIntegration only filters errors whose frames are all marked as third-party. Errors with zero frames bypass that check entirely.

Fix

A beforeSend hook checks whether every exception value in the event:

  1. Has no stack frames (missing or empty stacktrace.frames)
  2. Was captured by the global handler (mechanism.type is onerror or onunhandledrejection)

If both conditions hold for all exception values, the event is dropped (return null).

Fixes DOCS-AVV

IS YOUR CHANGE URGENT?

  • Urgent deadline
  • Other deadline
  • None: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

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
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Jun 9, 2026 11:06pm
sentry-docs Ready Ready Preview, Comment Jun 9, 2026 11:06pm

Request Review

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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';

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants