Skip to content

Commit cd768e8

Browse files
fix(workshop-app): filter playground errors from Sentry (#309)
Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Kent C. Dodds <[email protected]>
1 parent 9abb766 commit cd768e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/workshop-app/instrument.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'node:path'
12
import { nodeProfilingIntegration } from '@sentry/profiling-node'
23
import * as Sentry from '@sentry/react-router'
34

@@ -20,6 +21,15 @@ Sentry.init({
2021
}
2122
return process.env.NODE_ENV === 'production' ? 1 : 0
2223
},
24+
beforeSend(event) {
25+
const isPlaygroundError = event.exception?.values?.some(value =>
26+
value.stacktrace?.frames?.some(frame => frame.filename?.includes(`${path.sep}playground${path.sep}`))
27+
)
28+
if (isPlaygroundError) {
29+
return null
30+
}
31+
return event
32+
},
2333
beforeSendTransaction(event) {
2434
if (event.request?.headers?.['x-healthcheck'] === 'true') {
2535
return null

0 commit comments

Comments
 (0)