-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
sentry.client.config.ts
217 lines (171 loc) · 4.72 KB
/
sentry.client.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
import * as Sentry from '@sentry/nuxt'
import { useRuntimeConfig } from '#imports'
const config = useRuntimeConfig()
Sentry.init({
enabled: !import.meta.dev,
dsn: config.public.SENTRY_DSN,
tracesSampleRate: 0.2,
integrations: [
Sentry.replayIntegration({
maskAllText: false,
unblock: ['svg']
})
],
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0.5,
beforeSend(event, hint) {
if (isInjectedCode(event)) {
return null
}
return event
},
denyUrls: [
/**
* @see https://github.com/fdev/sentry-ignores
*/
// Specific files
/\/js\/popunder\.js/,
// Random plugins and extensions.
/^resource:\/\//i,
/127\.0\.0\.1:4001\/isrunning/i,
/bestpriceninja/i,
/googleapis/i,
/googlebot/i,
/googlest/i,
/itunes\.apple\.com\//i,
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
/re-markit/i,
/webappstoolbarba\.texthelp\.com\//i,
// Analytics.
/doubleclick\.net/i,
/hotjar\./i,
/netstats\.space/i,
/pagead\/js/i,
/posthog\.com/i,
// Chrome extensions.
/^chrome:\/\//i,
/chrome-extension:/i,
/extensions\//i,
// Facebook.
/connect\.facebook\.net\/en_US\/all\.js/i,
/graph\.facebook\.com/i,
// Kaspersky antivirus.
/kaspersky/i,
// Locally saved copies
/file:\/\//i,
// Proxy servers.
/nph-proxy\./i,
/\.cloudfront\..+\/statistic\//i,
// Safari extensions.
/safari-web-extension:/i,
/safari-extension:/i
],
ignoreErrors: [
// Build
// Media
'AbortError',
'Request aborted',
'Picture-in-Picture',
'webkitExitFullScreen',
'NotSupportedError: The operation is not supported', // Safari not compatible video - https://stackoverflow.com/a/47976124
// Network
// Service worker
'Registration failed - no active Service Worker',
// - Misc -
'ResizeObserver loop limit exceeded',
/**
* @see https://github.com/fdev/sentry-ignores
*/
// Random plugins and extensions.
// http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
'atomicFindClose',
"Can't find variable: ZiteReader",
'canvas.contentDocument',
'ComboSearch is not defined',
'http://loading.retry.widdit.com/',
'http://tt.epicplay.com',
'jigsaw is not defined',
'miscellaneous_bindings',
'MyApp_RemoveAllHighlights',
'originalCreateNotification',
'top.GLOBALS',
// Generic error code from errors outside the security sandbox.
'Script error.',
// Analytics code.
'vars.hotjar.com',
'doubleclick.net',
// Avast.
'_avast_',
// Facebook.
'fb_xd_fragment',
// Broadcom ASG error.
'ICAP Error',
// Bytemobile proxy.
'bmi_SafeAddOnload',
'EBCallBackMessageReceived',
// Conduit Toolbar.
'conduitPage',
// Chrome for iOS bug.
// https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/7VU0_VvC7mE
'__gCrWeb',
// Chromium bug.
// https://bugs.chromium.org/p/chromium/issues/detail?id=97172
'ntp is not defined',
// Edge on iOS.
'instantSearchSDKJSBridgeClearHighlight',
// Firefox bug.
// https://bugzilla.mozilla.org/show_bug.cgi?id=783260
// http://stackoverflow.com/a/13101119
'Permission denied to access property "toString"',
// Firefox internals.
'_firefox_',
// Firefox freeing add-on memory.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Dead_object
"can't access dead object",
// Nuance Dragon Web Extension.
'plugin.setSuspendState',
// Safari bug.
// https://bugs.webkit.org/show_bug.cgi?id=119472
'promiseReactionJob',
// SafeBrowse extension.
'jQSB',
// Commonly ignored errors of unknown origin.
'androidInterface',
'eshopcomp',
'eval at C',
'eval at E_c',
'frameConnector_isForegroundChanged',
'harkedtremblings',
'kw__injected',
'NPObject',
'siteroot',
'SymBrowser_',
'touchDownX',
'uiWebview_',
'variable: inf',
'Window.dologin'
]
})
/**
* Disable errors originating from injected scripts such as Google Tag Manager
* @see https://github.com/getsentry/sentry-javascript/issues/3147#issuecomment-1782504804
**/
function isInjectedCode(event: Sentry.Event | undefined): boolean {
const frames = event?.exception?.values?.[0]?.stacktrace?.frames
if (!frames || frames.length === 0) return false
const firstFrame = frames[0]
if (firstFrame.filename === '<anonymous>') {
return true
}
if (
frames.some(
(frame) =>
typeof frame.filename === 'string' &&
// Ignore errors from Partytown
frame.filename.includes('partytown')
)
) {
return true
}
return false
}