Files
supabase/apps/docs/instrumentation-client.ts
T
Ali Waseem 5b099ee03f chore: share Sentry browser-noise filters between studio and docs FE-4392 (#50407)
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

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-15 09:38:36 -06:00

42 lines
1.3 KiB
TypeScript

// This file configures the initialization of Sentry on the client.
// The added config here will be used whenever a user loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs'
import { hasConsented, IS_PLATFORM } from 'common'
import { BROWSER_NOISE_IGNORE_ERRORS, filterSentryEvent } from 'common/sentry'
import { IS_DEV } from './lib/constants'
if (!IS_DEV) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
integrations: (defaultIntegrations) => [
...defaultIntegrations,
Sentry.thirdPartyErrorFilterIntegration({
filterKeys: ['supabase-docs'],
behaviour: 'apply-tag-if-exclusively-contains-third-party-frames',
}),
],
ignoreErrors: [
...BROWSER_NOISE_IGNORE_ERRORS,
// [Charis 2025-05-05]
// We should fix hydration problems but let's not make this a blocker for
// now.
/(?:text content does not match)|hydration|hydrating/i,
],
beforeSend(event) {
return filterSentryEvent(event, { isPlatform: IS_PLATFORM, hasConsent: hasConsented() })
},
})
}
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart