Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Cleanup sentry filters (#20127)

Kamil Ogórek8e2dd4cdfc76
diff --git a/apps/studio/sentry.client.config.ts b/apps/studio/sentry.client.config.ts
index f8194191744..aefe8911127 100644
--- a/apps/studio/sentry.client.config.ts
+++ b/apps/studio/sentry.client.config.ts
@@ -20,17 +20,12 @@ Sentry.init({
}),
],
ignoreErrors: [
+ // Used exclusively in Monaco Editor.
'ResizeObserver',
- 'Non-Error exception captured',
- 'Non-Error promise rejection',
- '[object Event]',
// [Joshen] We currently use stripe-js for customers to save their credit card data
// I'm unable to reproduce this error on local, staging nor prod across chrome, safari or firefox
// Based on https://github.com/stripe/stripe-js/issues/26, it seems like this error is safe to ignore,
'Failed to load Stripe.js',
- // [Joshen] This is a chrome specific error, fix is out in chromium, pending chrome update
- // Ref: https://stackoverflow.com/questions/72437786/chrome-evalerror-possible-side-effect-in-debug
- 'Possible side-effect in debug-evaluate',
// [Joshen] This event started occurring after our fix in the org dropdown by reading the slug from
// the URL params instead of the store, but we cannot repro locally, staging nor on prod
// Safe to ignore since it's not a user-facing issue + we've not received any user feedback/report about it
@@ -39,15 +34,9 @@ Sentry.init({
'The provided `href` (/org/[slug]/team) value is missing query values (slug)',
'The provided `href` (/org/[slug]/billing) value is missing query values (slug)',
'The provided `href` (/org/[slug]/invoices) value is missing query values (slug)',
- // [Joshen] Seems to be from hcaptcha
- "undefined is not an object (evaluating 'n.chat.setReady')",
- "undefined is not an object (evaluating 'i.chat.setReady')",
],
- denyUrls: [
- // [Joshen] We're getting a huge influx of events from this particular source
- 'injectCoinbaseWalletDappProvider.js',
- ],
- beforeSend: (event) => filterConsoleErrors(event),
+ // Allow for exception captures originating only from our own code.
+ allowUrls: ['app:///_next/'],
})
// Replace dynamic query param with a template text
@@ -75,64 +64,3 @@ function standardiseRouterUrl(url: string) {
return finalUrl
}
-
-// Ignore dev console errors getting incorrectly thrown to sentry (Chrome specific)
-// https://github.com/getsentry/sentry-javascript/issues/5179#issuecomment-1206343862
-function filterConsoleErrors(event: any) {
- const originalException = event.exception?.values?.[0]
-
- // Console errors appear to always bubble up to `window.onerror` and to be unhandled. So if,
- // we don't have the original exception or the mechanism looks different, we can early return the event.
- // (Note, this might change depending on the used framework, so feel free to remove this check.)
- if (
- !originalException ||
- !originalException.mechanism ||
- originalException.mechanism.type !== 'onerror' ||
- originalException.mechanism.handled
- ) {
- return event
- }
-
- const stackFrames = originalException.stacktrace?.frames
- const errorType = originalException.type?.toLowerCase()
-
- // If we don't have any information on error type or stacktrace, we have no information about the error
- // this is unlikely to happen but it doesn't appear to happen in console errors.
- // Hence, we can early return here as well.
- if (!stackFrames || !errorType) {
- return event
- }
-
- // For simple console errors (e.g. users just typing a statement they want evaluated)
- // the stacktrace will only have one frame.
- // This condition will not catch errors that would be thrown if users type in multi-line
- // statements. For example, if they define a multi-line function.
- // You can try experimenting with this number but there's little guarantee that the other
- // conditions will work. Nevertheless, the checks below also work with multi-frame stacktraces.
- const hasShortStackTrace = stackFrames.length <= 2
- if (hasShortStackTrace && isSuspiciousError(errorType) && hasSuspiciousFrames(stackFrames)) {
- console.warn('Dropping error due to suspicious stack frames.')
- return null
- }
-
- return event
-}
-
-function isSuspiciousError(errorType: string) {
- return ['syntaxerror', 'referenceerror', 'typeerror'].includes(errorType)
-}
-
-function hasSuspiciousFrames(stackFrames: any[]) {
- const allSuspicious = stackFrames.every(isSuspiciousFrame)
-
- // Certain type errors will include the thrown error message as the second stack frame,
- // but the first will still follow the suspicious pattern.
- const firstSuspicious = stackFrames.length === 2 && isSuspiciousFrame(stackFrames[0])
-
- return allSuspicious || firstSuspicious
-}
-
-function isSuspiciousFrame(frame: any) {
- const url = window.location.href
- return frame.function === '?' && (frame.filename === '<anonymous>' || frame.filename === url)
-}
diff --git a/apps/studio/sentry.server.config.ts b/apps/studio/sentry.server.config.ts
index 1f069e3863f..adbc7851f7e 100644
--- a/apps/studio/sentry.server.config.ts
+++ b/apps/studio/sentry.server.config.ts
@@ -5,15 +5,11 @@ Sentry.init({
tracesSampleRate: 0.01,
debug: false,
ignoreErrors: [
+ // Used exclusively in Monaco Editor.
'ResizeObserver',
- 'Non-Error exception captured',
- 'Non-Error promise rejection',
// [Joshen] We currently use stripe-js for customers to save their credit card data
// I'm unable to reproduce this error on local, staging nor prod across chrome, safari or firefox
// Based on https://github.com/stripe/stripe-js/issues/26, it seems like this error is safe to ignore,
'Failed to load Stripe.js',
- // [Joshen] This is a chrome specific error, fix is out in chromium, pending chrome update
- // Ref: https://stackoverflow.com/questions/72437786/chrome-evalerror-possible-side-effect-in-debug
- 'Possible side-effect in debug-evaluate',
],
})