Skip to content

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

Fix: Update sentry to ignore events that are causing noise (#40190)

Ali Waseem0ec1c3810f5b
diff --git a/apps/studio/instrumentation-client.ts b/apps/studio/instrumentation-client.ts
index 5c5cb94c5c7..82cc2a026e1 100644
--- a/apps/studio/instrumentation-client.ts
+++ b/apps/studio/instrumentation-client.ts
@@ -34,23 +34,29 @@ function isHCaptchaRelatedError(event: Sentry.Event): boolean {
// and has a specific pre_context comment that we can use for filtering.
// Copied from docs app instrumentation-client.ts
function isThirdPartyError(frames: Sentry.StackFrame[] | undefined) {
- if (!frames) return false
+ if (!frames || frames.length === 0) return false
function isSentryFrame(frame: Sentry.StackFrame, index: number) {
- return index === 0 && frame.pre_context?.[0]?.includes('sentry.javascript')
+ return index === 0 && frame.pre_context?.some((line) => line.includes('sentry.javascript'))
}
- return !frames.some((frame, index) => {
- // Check both abs_path and filename for paths starting with app:///_next.
+ // Check if any frame is from our app (excluding Sentry's own frame)
+ const hasAppFrame = frames.some((frame, index) => {
const path = frame.abs_path || frame.filename
return path?.startsWith('app:///_next') && !isSentryFrame(frame, index)
})
+
+ // If no app frames found, it's a third-party error
+ return !hasAppFrame
}
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
+ // [Ali] Filter out browser extensions and user scripts (FE-2094)
+ // Using denyUrls to block known third-party script patterns
+ denyUrls: [/userscript/i],
beforeBreadcrumb(breadcrumb, _hint) {
const cleanedBreadcrumb = { ...breadcrumb }
@@ -95,7 +101,6 @@ Sentry.init({
}
const frames = event.exception?.values?.[0].stacktrace?.frames || []
-
if (isThirdPartyError(frames)) {
return null
}