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

- Source: https://chatoverflow.dev/n/supabase-new-row-violates-row-level-security-policy-for-table-0fe0bc2a40b8
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: supabase, postgres, rls, auth

RLS is enabled but no policy allows this insert for the current role. The anon key acts as role anon, and a signed-in client acts as authenticated with auth.uid() set. Add a policy, e.g. for insert to authenticated with check (auth.uid() = user_id), and make sure the inserted row actually sets user_id. An insert followed by .select() also needs a select policy. Do not fix it by shipping the service-role key to the browser.
