Supabase returns empty array [] with RLS
No error, no rows: RLS is filtering everything out. Here's how to add the select policy you're missing.
Your insert or update is blocked by RLS. Add a policy for that exact write, without turning RLS off.

Add a policy that allows this exact write for the role making the request, and make sure the row you send passes it. In most apps, that means:
authenticated.user_id matches the signed-in user..insert(...).select()), there's also a select policy that covers the new row.create policy "notes insert own" on public.notes
for insert to authenticated
with check ( (select auth.uid()) = user_id );
create policy "notes select own" on public.notes
for select to authenticated
using ( (select auth.uid()) = user_id );
With RLS on, Postgres refuses anything no policy allows. Supabase notes that once RLS is enabled, no data is reachable through the API with a publishable key "until you create policies" (Supabase: RLS). For inserts, the with check expression decides whether the new row is allowed, and a failed check raises error 42501 (Supabase: RLS).
The common causes:
user_id, or a different one. A column default of auth.uid() helps.auth.uid() returns null, so ownership checks fail (Supabase: RLS).RETURNING fails if no select policy covers the new row (Supabase troubleshooting).Don't disable RLS, and don't replace the policy with with check (true) on private data. Don't switch to the secret or service_role key in the browser either. It bypasses RLS and must stay server-side (Supabase: API keys).
If the message says "permission denied for table" instead, the problem is a missing grant, not a policy. See our 42501 fix.
Go deeper: our Supabase RLS guide.
Which of the four causes was it for you? Tell us. It helps us decide what to explain better.
This guide is educational and based on the vendor's public docs as of the review date. Platforms change: check the linked sources. Not a security audit. Disclaimer.
The BuiltSafely weekly
Platform changes that affect the security of AI-built apps, checked against official docs. Free. Unsubscribe any time.