Supabase returns an empty array [] but the table has data
Your Supabase query returns [] with no error even though rows exist? Row Level Security is on with no policy allowing the read.
Reviewed October 14, 2026
What it means in plain English
Supabase has a safety system called Row Level Security (RLS). When it's on and no rule allows a user to see a row, Supabase doesn't throw an error, it just quietly returns nothing.
Likely causes
- RLS is enabled on the table but no SELECT policy exists. Supabase docs: once RLS is enabled, no data is accessible via the API with a publishable key until you create policies.
- The policy only allows
authenticatedusers, but the visitor isn't signed in (or their session expired, soauth.uid()is null). - The policy compares
auth.uid()to auser_idcolumn that's empty or holds a different value.
How to fix it, step by step
- Supabase dashboard → Table Editor → select the table and check whether RLS is enabled and what policies exist (or Database → Policies).
- Decide who should see the rows:
- Public data (e.g. product list): add a SELECT policy for
anon, authenticatedwithusing (true). - Each user's own data: add a SELECT policy for
authenticatedwithusing ((select auth.uid()) = user_id).
- Public data (e.g. product list): add a SELECT policy for
- Example SQL (SQL Editor):
create policy "Users can view their own rows"
on public.todos for select
to authenticated
using ( (select auth.uid()) = user_id );
- Make sure rows actually have the correct
user_idfilled in when created. - Don't fix this by turning RLS off or by putting the secret/service_role key in the browser; that exposes all your data.
- Lovable/Bolt: you can ask "Add an RLS SELECT policy so signed-in users can read their own rows in
", then review the SQL before running it.
How to check it worked
- Reload the page while signed in; rows should appear.
- Sign in as a second user and confirm they can't see the first user's rows.
Sources
- https://supabase.com/docs/guides/database/postgres/row-level-security (opens in a new tab)
- https://supabase.com/docs/guides/api/securing-your-api (opens in a new tab)
- https://supabase.com/docs/guides/api/api-keys (opens in a new tab)
Related fixes
Request a fixCan't fix it? Get help.
If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.