Skip to content

Commit edd8cd0

Browse files
authored
One last time (#3889)
1 parent ba15893 commit edd8cd0

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

web/instrumentation-client.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ Sentry.init({
1212
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1313
debug: false,
1414
ignoreErrors: [
15+
"Can't find variable: _sz",
1516
'_sz is not defined', // Discards the specific ReferenceError
16-
/ReferenceError: _sz is not defined/i, // Alternative regex approach
17+
/_sz/i, // Alternative regex approach
1718
],
1819
denyUrls: [
1920
/gtm\.js/, // Blocks any error coming from the GTM script
2021
/app:\/\/\/gtm\.js/, // Matches the exact path pattern from your stack trace
2122
],
2223
beforeSend(event, hint) {
23-
const message = event.exception?.values?.[0]?.value || ''
24+
const message = event?.message || event.exception?.values?.[0]?.value || ''
2425

2526
// Drop the event if it mentions the missing _sz variable
26-
if (message.includes('_sz is not defined')) {
27+
if (message.includes('_sz')) {
2728
return null
2829
}
2930

web/sentry.edge.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,23 @@ Sentry.init({
1313

1414
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1515
debug: false,
16+
ignoreErrors: [
17+
"Can't find variable: _sz",
18+
'_sz is not defined', // Discards the specific ReferenceError
19+
/_sz/i, // Alternative regex approach
20+
],
21+
denyUrls: [
22+
/gtm\.js/, // Blocks any error coming from the GTM script
23+
/app:\/\/\/gtm\.js/, // Matches the exact path pattern from your stack trace
24+
],
25+
beforeSend(event, hint) {
26+
const message = event?.message || event.exception?.values?.[0]?.value || ''
27+
28+
// Drop the event if it mentions the missing _sz variable
29+
if (message.includes('_sz')) {
30+
return null
31+
}
32+
33+
return event
34+
},
1635
})

web/sentry.sever.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,23 @@ Sentry.init({
1212
tracesSampleRate: 1,
1313
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1414
debug: false,
15+
ignoreErrors: [
16+
"Can't find variable: _sz",
17+
'_sz is not defined', // Discards the specific ReferenceError
18+
/_sz/i, // Alternative regex approach
19+
],
20+
denyUrls: [
21+
/gtm\.js/, // Blocks any error coming from the GTM script
22+
/app:\/\/\/gtm\.js/, // Matches the exact path pattern from your stack trace
23+
],
24+
beforeSend(event, hint) {
25+
const message = event?.message || event.exception?.values?.[0]?.value || ''
26+
27+
// Drop the event if it mentions the missing _sz variable
28+
if (message.includes('_sz')) {
29+
return null
30+
}
31+
32+
return event
33+
},
1534
})

0 commit comments

Comments
 (0)