Skip to content

Commit f44f121

Browse files
committed
fix: force fix of sentry client
1 parent c7291c8 commit f44f121

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sentry.client.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ init({
1616
// we only want to capture errors from _next folder on production
1717
// we don't want to capture errors from preview branches here
1818
allowUrls: ['https://nodejs.org/_next'],
19+
// Filter-out Events/Errors that are invalid for us
20+
beforeSend: (event, hint) => {
21+
const originalException = hint.originalException as Error;
22+
23+
// All the Events we send must have a message and stack trace
24+
if (originalException?.message && originalException?.stack) {
25+
// All our Events come eventually from code that originates on node_modules
26+
// so everything else should be discarded
27+
// Even React Errors or other errors will eventually have node_modules in the code
28+
if (String(originalException.stack).includes('node_modules')) {
29+
return event;
30+
}
31+
}
32+
33+
return null;
34+
},
1935
});

0 commit comments

Comments
 (0)