Skip to content

fix(frontend): Filter out browser extension errors from Sentry SDK - #121992

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/sentry-sdk-deny-extension-errors
Open

fix(frontend): Filter out browser extension errors from Sentry SDK#121992
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/sentry-sdk-deny-extension-errors

Conversation

@sentry

@sentry sentry Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a recurring TypeError: Cannot read properties of undefined (reading 'location') originating from third-party browser extensions injecting code into Sentry's frontend pages.

Root Cause:
A Chrome browser extension (identified by paths like /extensions/google/setup/) injects JavaScript into Sentry's pages. During its setup, it attempts to access the document or window of embedded cross-origin iframes. This access is blocked by the browser with a SecurityError, causing the frame reference to become undefined. The extension then attempts to read .location from this undefined object, resulting in the TypeError.

These errors are not actionable by Sentry as they stem from external, third-party code.

Solution:
To reduce noise in Sentry's own error monitoring, denyUrls patterns have been added to the Sentry SDK initialization. This configuration will prevent events from being captured if their stack traces include URLs matching common browser extension schemes.

Changes Made:

  1. static/app/constants/sdk.ts: Added a new exported constant IGNORED_ERROR_DENY_URLS containing regex patterns for generic extension paths (/extensions/), and specific browser extension protocols (chrome-extension://, moz-extension://, safari-extension://).
  2. static/app/serviceWorker/worker/initializeSentry.ts: Imported IGNORED_ERROR_DENY_URLS and added it to the denyUrls option within the Sentry.init() call.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JAVASCRIPT-3B9Z

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 13, 2026

@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 bacb7d6. Configure here.

isInitialized = true;
Sentry.init({
allowUrls: SPA_DSN ? SPA_MODE_ALLOW_URLS : sentryConfig.allowUrls,
denyUrls: IGNORED_ERROR_DENY_URLS,

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.

Filter wired to wrong SDK

Medium Severity

IGNORED_ERROR_DENY_URLS is only passed into the service worker Sentry.init, but the extension TypeError comes from scripts injected into the page and is captured by initializeSdk. The worker also sets defaultIntegrations: false without adding the event/inbound filters integration, so denyUrls does not run there either. The new filter never drops the targeted events.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bacb7d6. Configure here.

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant