(sentry) filter out errors by inspecting the stacktrace

This commit is contained in:
Valentyne Stigloher 2024-03-09 14:56:37 +01:00
parent 2366ccb2af
commit 4e7dc34634

View File

@ -232,6 +232,38 @@ const nuxtConfig: NuxtConfig = {
return scope;
},
beforeSend(event) {
const denyUrls = [
'chrome-extension://',
'moz-extension://',
'webkit-masked-url://',
'https://s0.2mdn.net',
'https://j.adlooxtracking.com',
'https://c.amazon-adsystem.com',
'https://assets.a-mo.net',
'https://btloader.com',
'https://challenges.cloudflare.com',
'https://static.criteo.net',
'https://securepubads.g.doubleclick.net',
'https://cdn.flashtalking.com',
'https://ajs-assets.ftstatic.com',
'https://cdn.fuseplatform.net',
'https://cmp.inmobi.com',
'https://cdn.js7k.com',
'https://z.moatads.com',
'https://ced-ns.sascdn.com',
'https://a.teads.tv',
'https://s.yimg.com',
];
// filter out exceptions originating from third party
for (const exception of event.exception?.values || []) {
for (const frame of exception.stacktrace?.frames || []) {
if (denyUrls.some((denyUrl) => frame.abs_path?.startsWith(denyUrl))) {
return null;
}
}
}
// do not send user information as Sentry somehow automatically detects username, email and user id
// https://docs.sentry.io/platforms/javascript/data-management/sensitive-data/
delete event.user;
@ -243,30 +275,6 @@ const nuxtConfig: NuxtConfig = {
return event;
},
},
clientConfig: {
denyUrls: [
'chrome-extension://',
'moz-extension://',
'webkit-masked-url://',
's0.2mdn.net',
'j.adlooxtracking.com',
'c.amazon-adsystem.com',
'assets.a-mo.net',
'btloader.com',
'challenges.cloudflare.com',
'static.criteo.net',
'securepubads.g.doubleclick.net',
'cdn.flashtalking.com',
'ajs-assets.ftstatic.com',
'cdn.fuseplatform.net',
'cmp.inmobi.com',
'cdn.js7k.com',
'z.moatads.com',
'ced-ns.sascdn.com',
'a.teads.tv',
's.yimg.com',
],
},
},
publicRuntimeConfig: {
...config,