Hello @AnirbansarkarS i have found this issue during user registration, the application calls supabase.auth.signUp(...) and immediately attempts to insert a new row into the profiles table.
However, the profiles table is protected by Row Level Security (RLS) with the policy:
WITH CHECK (auth.uid() = id)
At the time of insertion, the newly created user session is not always fully authenticated yet. As a result, the insert request executes as an anonymous user and fails due to the RLS policy.
Current Error
new row violates row-level security policy for table "profiles"
Expected Behavior
Signup flow should complete successfully without RLS violations.
Possible fixes include:
-
Waiting until the authenticated session is fully available before inserting into profiles
-
Creating the profile server-side using:
- Supabase service role
- Edge Function / API route
- Database trigger
-
Ensuring profile creation happens in an authenticated context
Additional Context
There is also a related issue where repeated sign-up retries may trigger:
Email rate limit exceeded
This appears when confirmation emails are requested too frequently after failed signup attempts.
Suggested Improvements
- Add proper session readiness checks before profile insertion
- Improve error handling and retry logic during signup
- Prevent unnecessary repeated email confirmation requests
I would like to work on this issue under GSSOC '26.
Hello @AnirbansarkarS i have found this issue during user registration, the application calls
supabase.auth.signUp(...)and immediately attempts to insert a new row into theprofilestable.However, the
profilestable is protected by Row Level Security (RLS) with the policy:At the time of insertion, the newly created user session is not always fully authenticated yet. As a result, the insert request executes as an anonymous user and fails due to the RLS policy.
Current Error
Expected Behavior
Signup flow should complete successfully without RLS violations.
Possible fixes include:
Waiting until the authenticated session is fully available before inserting into
profilesCreating the profile server-side using:
Ensuring profile creation happens in an authenticated context
Additional Context
There is also a related issue where repeated sign-up retries may trigger:
This appears when confirmation emails are requested too frequently after failed signup attempts.
Suggested Improvements
I would like to work on this issue under GSSOC '26.