Skip to content

Commit

Permalink
web: Filter Sentry errors from third party scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
schneefux committed Dec 30, 2024
1 parent e9114d0 commit 60809b3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions web/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ export const config: Config = {
sentryDsn: process.env.SENTRY_DSN ?? '',
traduora: undefined,
}

export const SENTRY_APPLICATION_KEY = 'brawltime'
15 changes: 5 additions & 10 deletions web/renderer/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
reportingObserverIntegration,
rewriteFramesIntegration,
} from '@sentry/browser'
import { SENTRY_APPLICATION_KEY } from "~/config"

export const SentryInjectionKey = Symbol('sentry') as InjectionKey<typeof Sentry>

Expand All @@ -31,18 +32,12 @@ export function initSentry(dsn: string, app: App<Element>, 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',
Expand Down
2 changes: 2 additions & 0 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 60809b3

Please sign in to comment.