Skip to content

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

chore: Address the `Failed to construct 'URL': Invalid URL` error report in Sentry (#27245)

Ivan Vasilov30f43b05b139
diff --git a/apps/studio/sentry.client.config.ts b/apps/studio/sentry.client.config.ts
index c87aca25832..a7a1d4be1eb 100644
--- a/apps/studio/sentry.client.config.ts
+++ b/apps/studio/sentry.client.config.ts
@@ -7,13 +7,20 @@ Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 0.01,
debug: false,
- beforeSend(event) {
+ beforeSend(event, hint) {
const consent =
typeof window !== 'undefined'
? localStorage.getItem(LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT)
: null
if (IS_PLATFORM && consent === 'true') {
+ // Ignore invalid URL events for 99% of the time because it's using up a lot of quota.
+ const isInvalidUrlEvent = (hint.originalException as any)?.message?.includes(
+ `Failed to construct 'URL': Invalid URL`
+ )
+ if (isInvalidUrlEvent && Math.random() > 0.01) {
+ return null
+ }
return event
}
return null