Skip to content

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

Handle 409 in create profile (#35504)

Joshen Lim4702133591b0
diff --git a/apps/studio/lib/profile.tsx b/apps/studio/lib/profile.tsx
index 2064a9cffa6..161cb88549f 100644
--- a/apps/studio/lib/profile.tsx
+++ b/apps/studio/lib/profile.tsx
@@ -40,8 +40,19 @@ export const ProfileProvider = ({ children }: PropsWithChildren<{}>) => {
sendEvent({ action: 'sign_up', properties: { category: 'conversion' } })
},
onError: (error) => {
- Sentry.captureMessage('Failed to create users profile: ' + error.message)
- toast.error('Failed to create your profile. Please refresh to try again.')
+ if (error.code === 409) {
+ // [Joshen] There's currently an assumption that createProfile is getting triggered
+ // multiple times unnecessarily, although the tracing the code i can't see why this might
+ // be happening unless GET profile is somehow returning `User's profile not found` incorrectly
+ // Adding a Sentry capture + toast in hopes to catch this while developing on local / staging
+ Sentry.captureMessage('Profile already exists: ' + error.message)
+ if (process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod') {
+ toast.error('[DEV] createProfile called despite profile already exists: ' + error.message)
+ }
+ } else {
+ Sentry.captureMessage('Failed to create users profile: ' + error.message)
+ toast.error('Failed to create your profile. Please refresh to try again.')
+ }
},
})