Skip to content

Commit 2dbc292

Browse files
committed
feat(sentry): ignore local ‘Failed to fetch’ noise when server is down (Fixes EPICSHOP-4D)
1 parent 406110f commit 2dbc292

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/workshop-app/app/utils/monitoring.client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export function init() {
2020
"Failed to execute 'requestPictureInPicture' on 'HTMLVideoElement'",
2121
],
2222
beforeSend(event) {
23+
// Very common when learners shut down the local server and the browser keeps trying to fetch
24+
const failedToFetch =
25+
event.exception?.values?.some(
26+
(v) =>
27+
typeof v.value === 'string' && /Failed to fetch/i.test(v.value),
28+
) ?? false
29+
30+
if (failedToFetch && !ENV.EPICSHOP_DEPLOYED) return null
31+
2332
if (
2433
event.exception?.values?.some((value) =>
2534
value.stacktrace?.frames?.some(

0 commit comments

Comments
 (0)