From 5b099ee03f5045dc2f6306ff4b1664c8aea479ed Mon Sep 17 00:00:00 2001 From: Ali Waseem Date: Tue, 15 Sep 2026 09:38:36 -0600 Subject: [PATCH] chore: share Sentry browser-noise filters between studio and docs FE-4392 (#50407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Studio and docs each kept their own Sentry `ignoreErrors` list, so browser-extension and DOM-mutation noise that Studio already filtered still reached Sentry from docs. Moved the app-agnostic filters (network, extension DOM mutation, non-Error throws, cross-origin script errors) into `packages/common/sentry.ts` and spread them into both client configs, leaving app-specific entries local. Docs will stop reporting extension-driven `insertBefore`/`removeChild` crashes, matching Studio's existing behavior — `ignoreErrors` drops events before `beforeSend` runs, so the error-boundary exemption no longer applies to them. Fixes FE-4392 ## Summary by CodeRabbit - **Bug Fixes** - Reduced non-actionable browser noise in error monitoring by filtering known network, browser extension, DOM-manipulation, cross-origin, and non-error failures. - Applied consistent filtering across the documentation site and studio error tracking. --- apps/docs/instrumentation-client.ts | 4 ++- apps/studio/lib/sentry-client-options.ts | 35 ++++-------------------- packages/common/sentry.ts | 31 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/apps/docs/instrumentation-client.ts b/apps/docs/instrumentation-client.ts index e3490825598..970e2e6ec28 100644 --- a/apps/docs/instrumentation-client.ts +++ b/apps/docs/instrumentation-client.ts @@ -4,7 +4,7 @@ import * as Sentry from '@sentry/nextjs' import { hasConsented, IS_PLATFORM } from 'common' -import { filterSentryEvent } from 'common/sentry' +import { BROWSER_NOISE_IGNORE_ERRORS, filterSentryEvent } from 'common/sentry' import { IS_DEV } from './lib/constants' @@ -24,6 +24,8 @@ if (!IS_DEV) { ], ignoreErrors: [ + ...BROWSER_NOISE_IGNORE_ERRORS, + // [Charis 2025-05-05] // We should fix hydration problems but let's not make this a blocker for // now. diff --git a/apps/studio/lib/sentry-client-options.ts b/apps/studio/lib/sentry-client-options.ts index d2d24b6af39..9e9e5cb0ae4 100644 --- a/apps/studio/lib/sentry-client-options.ts +++ b/apps/studio/lib/sentry-client-options.ts @@ -16,7 +16,11 @@ import * as Sentry from '@sentry/react' import { thirdPartyErrorFilterIntegration } from '@sentry/react' import { hasConsented } from 'common' import { IS_PLATFORM } from 'common/constants/environment' -import { filterSentryEvent, isSentryErrorBoundaryCrash } from 'common/sentry' +import { + BROWSER_NOISE_IGNORE_ERRORS, + filterSentryEvent, + isSentryErrorBoundaryCrash, +} from 'common/sentry' import { MIRRORED_BREADCRUMBS } from '@/lib/breadcrumbs' import { sanitizeArrayOfObjects, sanitizeUrlHashParams } from '@/lib/sanitize' @@ -256,34 +260,7 @@ export function buildSentryClientOptions({ // sql-formatter lexer on invalid SQL input /^Parse error: Unexpected ".+" at line \d+ column \d+$/, - // === Network / infrastructure (not actionable on FE) === - /504 Gateway Time-out/, - 'Network request failed', - 'Failed to fetch', - 'Load failed', - 'AbortError', - 'TypeError: cancelled', - 'TypeError: Cancelled', - - // === Browser extensions & Google Translate DOM manipulation === - 'Node.insertBefore: Child to insert before is not a child of this node', - 'Node.removeChild: The node to be removed is not a child of this node', - "NotFoundError: Failed to execute 'removeChild' on 'Node'", - "NotFoundError: Failed to execute 'insertBefore' on 'Node'", - 'NotFoundError: The object can not be found here.', - "Cannot read properties of null (reading 'parentNode')", - "Cannot read properties of null (reading 'removeChild')", - "TypeError: can't access dead object", - /^NS_ERROR_/, - - // === Non-Error throws (extensions, third-party libs throwing strings/objects) === - 'Non-Error exception captured', - 'Non-Error promise rejection captured', - /^Object captured as exception with keys:/, - - // === Cross-origin script errors (no useful info) === - 'Script error.', - 'Script error', + ...BROWSER_NOISE_IGNORE_ERRORS, // === React hydration mismatches caused by extensions modifying DOM === // Note: we only suppress the generic browser messages, NOT "Hydration failed because..." diff --git a/packages/common/sentry.ts b/packages/common/sentry.ts index 3e2eb63a33b..d1573a6ebae 100644 --- a/packages/common/sentry.ts +++ b/packages/common/sentry.ts @@ -32,3 +32,34 @@ export function filterSentryEvent( return event } + +export const BROWSER_NOISE_IGNORE_ERRORS: (string | RegExp)[] = [ + // === Network / infrastructure (not actionable on FE) === + /504 Gateway Time-out/, + 'Network request failed', + 'Failed to fetch', + 'Load failed', + 'AbortError', + 'TypeError: cancelled', + 'TypeError: Cancelled', + + // === Browser extensions & Google Translate DOM manipulation === + 'Node.insertBefore: Child to insert before is not a child of this node', + 'Node.removeChild: The node to be removed is not a child of this node', + "NotFoundError: Failed to execute 'removeChild' on 'Node'", + "NotFoundError: Failed to execute 'insertBefore' on 'Node'", + 'NotFoundError: The object can not be found here.', + "Cannot read properties of null (reading 'parentNode')", + "Cannot read properties of null (reading 'removeChild')", + "TypeError: can't access dead object", + /^NS_ERROR_/, + + // === Non-Error throws (extensions, third-party libs throwing strings/objects) === + 'Non-Error exception captured', + 'Non-Error promise rejection captured', + /^Object captured as exception with keys:/, + + // === Cross-origin script errors (no useful info) === + 'Script error.', + 'Script error', +]