Supabase Returns an Empty Array With No Error? Here's Why (and the Fix)
If your Supabase query returns [] with a 200 status and no error, Row Level Security is almost certainly hiding the rows. RLS is enabled on the table, but there is no SELECT policy that lets the current user read them. Add a SELECT policy and the data appears.
3 min read

Quick answer: If your Supabase query returns [] with a 200 status and no error, Row Level Security is almost certainly hiding the rows. RLS is enabled on the table, but there is no SELECT policy that lets the current user read them. Add a SELECT policy and the data appears.
This one wastes hours because nothing looks broken. The table has data. The query is correct. The network tab shows 200 OK. The page is still empty.
Why Supabase gives you nothing instead of an error
For reads, RLS works as a silent filter. Postgres does not say "access denied". It returns only the rows you are allowed to see. With no SELECT policy, that is zero rows, so you get an empty array and no warning. Writes behave differently: a blocked insert throws an error (see Post 1).
Confirm it is RLS in 60 seconds
Test 1. Query in the SQL Editor. The dashboard SQL Editor bypasses RLS.
select * from public.todos limit 5;
Rows show here but not in your app? It is RLS or auth. No rows here either? The table is empty or you are in the wrong project.
Test 2. Check RLS and policies.
select tablename, rowsecurity
from pg_tables
where schemaname = 'public' and tablename = 'todos';
select policyname, cmd, roles, qual
from pg_policies
where tablename = 'todos';
rowsecurity = true with no policy where cmd is SELECT or ALL confirms it.
The fix
For private, per-user data:
create policy "Users can read their own rows"
on public.todos
for select
to authenticated
using ((select auth.uid()) = user_id);
For data everyone should see, such as a public product list:
create policy "Anyone can read products"
on public.products
for select
to anon, authenticated
using (true);
Only use the second version for tables with nothing private in them.
Policy exists and it is still empty? Check these 4 things
- The query runs before login finishes. The request goes out as
anon, the policy allows onlyauthenticated. Wait for the session before fetching. In React, fetch insideonAuthStateChangeor aftergetSession()resolves. - Old rows have an empty
user_id. Rows created before the column existed match nobody. Check withselect count(*) from todos where user_id is null; - The
user_idholds the wrong ID. It must store theauth.usersID, not an ID from your own profiles table. - Your app points to a different Supabase project. Compare
VITE_SUPABASE_URLorNEXT_PUBLIC_SUPABASE_URLin your host with the project you are looking at.
The prompt to give your AI tool
The query on
todosreturns an empty array with no error. Do not change the query and do not disable RLS. Check whether a SELECT policy exists for the authenticated role using auth.uid() = user_id. If it is missing, write the SQL. Also confirm the fetch waits for the auth session to load.
FAQ
Why does .single() throw PGRST116 instead? .single() expects exactly one row. RLS returned zero, so it errors. Same root cause, same fix. Use .maybeSingle() if zero rows is a valid result.
It works when I am logged in as me but not for other users. Your policy or your data is tied to one user ID. Check cause 2 and 3 above.
Realtime subscriptions receive nothing. Realtime respects RLS too. The same SELECT policy is required.
Can I just turn RLS off to test? Only on a table with no real data, and turn it back on immediately. With RLS off, anyone with your public key can read the table.
Still stuck?
Rayionyx fixes broken AI-built apps. Run the free scan at rayionyx.com, or book the $199 Rescue Audit for a full written report in 24 hours.