From b9a93f16723714751d03fe8d05607e366634b1b1 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Thu, 22 Sep 2022 01:54:56 +1000 Subject: Fixed? sentry stuff --- bundle/src/Server.ts | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'bundle/src/Server.ts') diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index d6200f83..db417f11 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -76,16 +76,33 @@ async function main() { ], tracesSampleRate: Config.get().sentry.traceSampleRate, environment: Config.get().sentry.environment, - beforeSend: (event, hint) => { - const url = event.request?.url; - if (url && url.includes("/assets/")) return null; + }); + + Sentry.addGlobalEventProcessor((event, hint) => { + if (event.transaction) { + event.transaction = event.transaction.split("/").map(x => !parseInt(x) ? x : ":id").join("/"); + } + + delete event.request?.cookies; + if (event.request?.headers) { + delete event.request.headers["X-Real-Ip"]; + delete event.request.headers["X-Forwarded-For"]; + delete event.request.headers["X-Forwarded-Host"]; + delete event.request.headers["X-Super-Properties"]; + } + + if (event.breadcrumbs) { + event.breadcrumbs = event.breadcrumbs.filter(x => { + if (x.message?.includes("identified as")) return false; + if (x.message?.includes("[WebSocket] closed 4009 ")) return false; + if (x.message?.includes("Got Resume -> cancel not implemented")) return false; + if (x.message?.includes("[Gateway] New connection from")) return false; - if (event.request?.url) { - event.request.url = event.request.url.split("/").map(x => !parseInt(x) ? x : ":id").join("/"); - } + return true; + }) + } - return event; - }, + return event; }); app.use(Sentry.Handlers.requestHandler()); -- cgit 1.4.1