From 60809b354c7097c7768db9097d0c21d1f322f352 Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 30 Dec 2024 11:57:24 +0100 Subject: [PATCH] web: Filter Sentry errors from third party scripts --- web/config.ts | 2 ++ web/renderer/sentry.ts | 15 +++++---------- web/vite.config.ts | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/web/config.ts b/web/config.ts index cab4d6f5..3a4d1c55 100644 --- a/web/config.ts +++ b/web/config.ts @@ -27,3 +27,5 @@ export const config: Config = { sentryDsn: process.env.SENTRY_DSN ?? '', traduora: undefined, } + +export const SENTRY_APPLICATION_KEY = 'brawltime' diff --git a/web/renderer/sentry.ts b/web/renderer/sentry.ts index 052d1413..4ed882b2 100644 --- a/web/renderer/sentry.ts +++ b/web/renderer/sentry.ts @@ -7,6 +7,7 @@ import { reportingObserverIntegration, rewriteFramesIntegration, } from '@sentry/browser' +import { SENTRY_APPLICATION_KEY } from "~/config" export const SentryInjectionKey = Symbol('sentry') as InjectionKey @@ -31,18 +32,12 @@ export function initSentry(dsn: string, app: App, router?: Router) { maskAllInputs: false, blockAllMedia: false, }), + Sentry.thirdPartyErrorFilterIntegration({ + filterKeys: [SENTRY_APPLICATION_KEY], + behaviour: 'drop-error-if-exclusively-contains-third-party-frames', + }), ], ignoreErrors: [ - // ignore common errors triggered by ads - 'ReportingObserver [deprecation]', - '[GPT] ', - 'SYNC.JS', - 'ox_esp', - 'Tyche blocked', - 'fun-hooks: hooked function not ready', - 'The play() request was interrupted', - 'Geo location is undefined or empty', - '33Across Lexicon ID Mappings Provider: PID not found', // ignore errors that are not actionable 'Already on path:', 'Unable to preload CSS', diff --git a/web/vite.config.ts b/web/vite.config.ts index c9054c1a..b05ecccd 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -11,6 +11,7 @@ import { sentryVitePlugin } from '@sentry/vite-plugin' import { vavite } from 'vavite' import legacy from '@vitejs/plugin-legacy' import manifest from './manifest' +import { SENTRY_APPLICATION_KEY } from './config' const config: UserConfig = { buildSteps: [ @@ -57,6 +58,7 @@ const config: UserConfig = { ssr({ disableAutoFullBuild: true }), legacy(), process.env.VITE_GIT_REV != undefined ? sentryVitePlugin({ + applicationKey: SENTRY_APPLICATION_KEY, release: { name: `brawltimeninja@${process.env.VITE_GIT_REV}`, setCommits: {