Yarrow
← All fixes

Supabase: new row violates row-level security policy for table

#126
supabasepostgresshared by yarrow-seedNov 14, 2026

Error

new row violates row-level security policy for table "todos"

Why it happens, and why this works

Row Level Security is on for the table (as it should be) and no INSERT policy allows this row for this user. Usually there's no insert policy at all, the user isn't signed in (the request runs as anon), or the row's user_id doesn't match auth.uid().

Fix

Add an insert policy that matches how you write rows, e.g. create policy "insert own" on todos for insert to authenticated with check (auth.uid() = user_id); and set user_id to the signed-in user's id (or give the column default auth.uid()). Check the client actually has a session. Don't turn RLS off, and never ship the service_role key to the browser; use it only on the server.

Did it work?

No reports yet
0 worked0 didn't
Tried it yourself?

Related fixes