Skip to content

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

White list some non critical auth errors (#27049)

Joshen Limfcbf4f8f0688
diff --git a/apps/studio/components/interfaces/SignIn/ResetPasswordForm.tsx b/apps/studio/components/interfaces/SignIn/ResetPasswordForm.tsx
index b02724dd9ee..9d8bae740db 100644
--- a/apps/studio/components/interfaces/SignIn/ResetPasswordForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/ResetPasswordForm.tsx
@@ -6,6 +6,8 @@ import { auth } from 'lib/gotrue'
import { passwordSchema } from 'lib/schemas'
import { Button, Form, Input } from 'ui'
+const WHITELIST_ERRORS = ['New password should be different from the old password']
+
const ResetPasswordForm = () => {
const router = useRouter()
@@ -21,7 +23,9 @@ const ResetPasswordForm = () => {
await router.push('/projects')
} else {
toast.error(`Failed to save password: ${error.message}`, { id: toastId })
- Sentry.captureMessage('[CRITICAL] Failed to reset password: ' + error.message)
+ if (!WHITELIST_ERRORS.includes(error.message)) {
+ Sentry.captureMessage('[CRITICAL] Failed to reset password: ' + error.message)
+ }
}
}
diff --git a/apps/studio/components/interfaces/SignIn/SignInSSOForm.tsx b/apps/studio/components/interfaces/SignIn/SignInSSOForm.tsx
index 2df60abc2c6..900ce8590e3 100644
--- a/apps/studio/components/interfaces/SignIn/SignInSSOForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignInSSOForm.tsx
@@ -9,6 +9,8 @@ import { BASE_PATH } from 'lib/constants'
import { auth, buildPathWithParams } from 'lib/gotrue'
import { Button, Form, Input } from 'ui'
+const WHITELIST_ERRORS = ['No SSO provider assigned for this domain']
+
const SignInSSOForm = () => {
const queryClient = useQueryClient()
const captchaRef = useRef<HCaptcha>(null)
@@ -54,7 +56,10 @@ const SignInSSOForm = () => {
setCaptchaToken(null)
captchaRef.current?.resetCaptcha()
toast.error(`Failed to sign in: ${error.message}`, { id: toastId })
- Sentry.captureMessage('[CRITICAL] Failed to sign in via SSO: ' + error.message)
+
+ if (!WHITELIST_ERRORS.includes(error.message)) {
+ Sentry.captureMessage('[CRITICAL] Failed to sign in via SSO: ' + error.message)
+ }
}
}
diff --git a/apps/studio/components/interfaces/SignIn/SignInWithSSO.tsx b/apps/studio/components/interfaces/SignIn/SignInWithSSO.tsx
deleted file mode 100644
index 1ff6f1f13ca..00000000000
--- a/apps/studio/components/interfaces/SignIn/SignInWithSSO.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { Lock } from 'lucide-react'
-import Link from 'next/link'
-import { Button } from 'ui'
-
-const SignInWithSSO = ({ searchParams }: { searchParams?: string }) => {
- return (
- <Button asChild block size="large" type="outline" icon={<Lock width={18} height={18} />}>
- <Link
- href={{
- pathname: '/sign-in-sso',
- query: searchParams,
- }}
- >
- Continue with SSO
- </Link>
- </Button>
- )
-}
-
-export default SignInWithSSO
diff --git a/apps/studio/components/interfaces/SignIn/SignUpForm.tsx b/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
index 53af5276d50..73c4b27475c 100644
--- a/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
@@ -20,6 +20,8 @@ import {
} from 'ui'
import PasswordConditionsHelper from './PasswordConditionsHelper'
+const WHITELIST_ERRORS = ['A user with this email already exists']
+
const signUpSchema = passwordSchema.shape({
email: yup.string().email().required().label('Email'),
})
@@ -40,7 +42,10 @@ const SignUpForm = () => {
setCaptchaToken(null)
captchaRef.current?.resetCaptcha()
toast.error(`Failed to sign up: ${error.message}`)
- Sentry.captureMessage('[CRITICAL] Failed to sign up: ' + error.message)
+
+ if (!WHITELIST_ERRORS.includes(error.message)) {
+ Sentry.captureMessage('[CRITICAL] Failed to sign up: ' + error.message)
+ }
},
})
diff --git a/apps/studio/pages/sign-in.tsx b/apps/studio/pages/sign-in.tsx
index 46a3e85a26f..0a916583964 100644
--- a/apps/studio/pages/sign-in.tsx
+++ b/apps/studio/pages/sign-in.tsx
@@ -1,13 +1,14 @@
+import { Lock } from 'lucide-react'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import SignInForm from 'components/interfaces/SignIn/SignInForm'
import SignInWithGitHub from 'components/interfaces/SignIn/SignInWithGitHub'
-import SignInWithSSO from 'components/interfaces/SignIn/SignInWithSSO'
import { SignInLayout } from 'components/layouts'
import { IS_PLATFORM } from 'lib/constants'
import type { NextPageWithLayout } from 'types'
+import { Button } from 'ui'
const SignInPage: NextPageWithLayout = () => {
const router = useRouter()
@@ -24,7 +25,16 @@ const SignInPage: NextPageWithLayout = () => {
<>
<div className="flex flex-col gap-5">
<SignInWithGitHub />
- <SignInWithSSO searchParams={searchParams} />
+ <Button asChild block size="large" type="outline" icon={<Lock width={18} height={18} />}>
+ <Link
+ href={{
+ pathname: '/sign-in-sso',
+ query: searchParams,
+ }}
+ >
+ Continue with SSO
+ </Link>
+ </Button>
<div className="relative">
<div className="absolute inset-0 flex items-center">