From d07b3f74a913d83b5bde29dd376a5573452e1542 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 9 Jun 2026 22:37:37 +0000 Subject: [PATCH] fix(sentry): Filter third-party global handler noise with no stack frames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add "^he$" to ignoreErrors to drop the specific minified "Error: he" from browser extensions/injected scripts. Also add a beforeSend filter that drops any error event with a single exception and zero stack frames — these are never actionable and always originate from third-party code outside the instrumented bundle. The existing thirdPartyErrorFilterIntegration only handles errors with third-party frames; this closes the gap for errors with no frames at all. Fixes DOCS-AVV Co-Authored-By: Claude --- src/instrumentation-client.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/instrumentation-client.ts b/src/instrumentation-client.ts index af83ecd7ec3c3e..140909f60e9604 100644 --- a/src/instrumentation-client.ts +++ b/src/instrumentation-client.ts @@ -4,8 +4,8 @@ import * as Spotlight from '@spotlightjs/spotlight'; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, - // Ignore errors injected by Brave/Firefox iOS browser scripts (third-party browser noise) - ignoreErrors: [/__firefox__/, /DarkReader/], + // Ignore errors from third-party/injected scripts (browser extensions, ad-blockers, etc.) + ignoreErrors: [/__firefox__/, /DarkReader/, /^he$/], // Adjust this value in production, or use tracesSampler for greater control tracesSampleRate: 0.3, @@ -40,6 +40,17 @@ Sentry.init({ Sentry.consoleLoggingIntegration(), ], + beforeSend(event) { + const values = event.exception?.values; + if (values?.length === 1) { + const frames = values[0].stacktrace?.frames; + if (!frames || frames.length === 0) { + return null; + } + } + return event; + }, + // Filter sensitive metric attributes (no PII in metrics) beforeSendMetric: metric => { // Remove any accidentally added PII attributes