Guide
Row-level security error saving a profile right after sign-up
Updated
A new person signs up, the app tries to save their profile, and it fails with "new row violates row-level security policy" for the profiles table.
Why it happens
Row-level security runs inside the database on every access. For an insert, the rule has to confirm the new row belongs to the person making the request. With it on and no matching rule, the row is rejected.
Possible causes
- The profiles table has row-level security on, but no insert rule that lets a new user write their own row.
- There is no read rule, so the new row cannot be read back and the request fails.
- The row is written with a different or empty user ID than the signed-in user's.
- The save runs before the person is signed in: if email confirmation is on, a save made immediately after sign-up may have no signed-in user.
- The profile is created by a database trigger that errors, which can block the sign-up itself.
You can't see it yourself
You're signed in, your customers aren't. Your own account was created long ago and already has a profile. The step that fails is the first save for a brand-new account.
Related: Data won't save: "new row violates row-level security policy" · "Database error saving new user" on sign-up · Supabase "permission denied for table" (42501)
VibeFix is independent. Lovable, Bolt, Replit, Base44, v0, Supabase, Firebase, Stripe and Vercel are trademarks of their owners.
Want it fixed?
Our AI agent finds the cause, fixes it in your code and re-checks your live app. $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
It starts with a free check that confirms the problem on your live app, no account needed.