fix(frontend): Filter out browser extension errors from Sentry SDK - #121992
fix(frontend): Filter out browser extension errors from Sentry SDK#121992sentry[bot] wants to merge 1 commit into
Conversation
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 bacb7d6. Configure here.
| isInitialized = true; | ||
| Sentry.init({ | ||
| allowUrls: SPA_DSN ? SPA_MODE_ALLOW_URLS : sentryConfig.allowUrls, | ||
| denyUrls: IGNORED_ERROR_DENY_URLS, |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit bacb7d6. Configure here.


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 thedocumentorwindowof embedded cross-origin iframes. This access is blocked by the browser with aSecurityError, causing the frame reference to becomeundefined. The extension then attempts to read.locationfrom thisundefinedobject, resulting in theTypeError.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,
denyUrlspatterns 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:
static/app/constants/sdk.ts: Added a new exported constantIGNORED_ERROR_DENY_URLScontaining regex patterns for generic extension paths (/extensions/), and specific browser extension protocols (chrome-extension://,moz-extension://,safari-extension://).static/app/serviceWorker/worker/initializeSentry.ts: ImportedIGNORED_ERROR_DENY_URLSand added it to thedenyUrlsoption within theSentry.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