From ddbf4022ee3208dc7647322fe7501e7c4794bfbf Mon Sep 17 00:00:00 2001 From: TkDodo Date: Tue, 17 Mar 2026 19:49:10 +0100 Subject: [PATCH] fix(router): filter out non-actionable errors from third-party scripts --- src/router.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/router.tsx b/src/router.tsx index ecefda06..6d830ecb 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -53,6 +53,27 @@ if (typeof document !== 'undefined') { // Session Replay replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. + beforeSend(event) { + // Filter out errors from third-party ad tech scripts (e.g. Publift's + // Fuse Platform ftUtils.js) that are not actionable by us. + const frames = event.exception?.values?.flatMap( + (v) => v.stacktrace?.frames ?? [], + ) + if ( + frames && + frames.length > 0 && + frames.every((frame) => { + const filename = frame.filename ?? '' + return ( + filename.includes('ftUtils.js') || + filename.includes('fuseplatform.net') + ) + }) + ) { + return null + } + return event + }, }) deferSentryReplayIntegration()