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 66d1684
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/api/services/MapReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { winRateAdjMergedMetric } from "~/lib/klicker.cubes"
import { formatDistanceToNow, subWeeks, differenceInDays } from 'date-fns'
import { FandomModeData } from "./FandomService"
import { Locale, loadLocaleWithFallback, locales } from "~/locales"
import { config } from "~/config"
import { config } from "~/config/config"

const comparingAccessoryQuery = (accessory: 'gears'|'gadgets'|'starpowers', slices: SliceValue) => {
return {
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions web/config/sentry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const SENTRY_APPLICATION_KEY = 'brawltime'

export const SENTRY_REPO = 'schneefux/brawltimeninja'
2 changes: 1 addition & 1 deletion web/locales/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config } from "~/config"
import { Config } from "~/config/config"
import { Cache } from "~/lib/cache"

const LOCALE_CACHE_MINUTES = 60
Expand Down
2 changes: 1 addition & 1 deletion web/renderer/+onBeforeRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PageContext } from './types'
import * as Sentry from '@sentry/vue'
import { getTraduoraToken, TraduoraToken } from '~/locales'
import { Dispatcher, Agent } from 'undici'
import { config, Config } from '~/config'
import { config, Config } from '~/config/config'

export { onBeforeRender }

Expand Down
2 changes: 1 addition & 1 deletion web/renderer/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import routes from '~pages'
import { AppI18n } from './app'
import { PageContext } from './types'
import { getPathWithLocale, getSelfOrigin } from '~/composables/compat'
import { Config } from '~/config'
import { Config } from '~/config/config'

export { createRouter }

Expand Down
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/sentry"

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: 1 addition & 1 deletion web/renderer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as SentryTypes from '@sentry/core'
import type { PageContextBuiltInServer } from 'vike/types'
import type { ComponentPublicInstance } from 'vue'
import { LocaleIso } from '~/locales'
import { Config } from '~/config'
import { Config } from '~/config/config'

type PageProps = Record<string, unknown>

Expand Down
6 changes: 4 additions & 2 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Pages from 'vite-plugin-pages'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { vavite } from 'vavite'
import legacy from '@vitejs/plugin-legacy'
import manifest from './manifest'
import manifest from './config/manifest'
import { SENTRY_APPLICATION_KEY, SENTRY_REPO } from './config/sentry'

const config: UserConfig = {
buildSteps: [
Expand Down Expand Up @@ -57,11 +58,12 @@ 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: {
auto: false,
repo: 'schneefux/brawltimeninja',
repo: SENTRY_REPO,
commit: process.env.VITE_GIT_REV,
},
},
Expand Down

0 comments on commit 66d1684

Please sign in to comment.