Skip to content

Commit fb4dc25

Browse files
fix(router): filter out non-actionable errors from third-party scripts (#771)
Co-authored-by: Sarah Gerrard <gerrardsarah@gmail.com>
1 parent 145dfab commit fb4dc25

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/router.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,27 @@ if (typeof document !== 'undefined') {
5353
// Session Replay
5454
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.
5555
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
56+
beforeSend(event) {
57+
// Filter out errors from third-party ad tech scripts (e.g. Publift's
58+
// Fuse Platform ftUtils.js) that are not actionable by us.
59+
const frames = event.exception?.values?.flatMap(
60+
(v) => v.stacktrace?.frames ?? [],
61+
)
62+
if (
63+
frames &&
64+
frames.length > 0 &&
65+
frames.every((frame) => {
66+
const filename = frame.filename ?? ''
67+
return (
68+
filename.includes('ftUtils.js') ||
69+
filename.includes('fuseplatform.net')
70+
)
71+
})
72+
) {
73+
return null
74+
}
75+
return event
76+
},
5677
})
5778

5879
deferSentryReplayIntegration()

0 commit comments

Comments
 (0)