File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments