← All errors · SupabaseSupabase database & RLS errors
Supabase select returns an empty array (no error)
Exact error
{ data: [], error: null }What it means
With RLS enabled and no SELECT policy matching the user, Postgres silently filters out all rows. No error is raised.
Likely causes
- RLS enabled with no SELECT policy.
- Policy restricts to authenticated but the request is anonymous.
- Querying the wrong schema or table name.
How to fix it
Add a select policy:
create policy "Users can read their own todos" on public.todos for select to authenticated using ( (select auth.uid()) = user_id );For public data, allow anon reads explicitly:
create policy "Public read" on public.posts for select to anon, authenticated using ( true );Test in the SQL editor's role switcher, or check the user session in the client.
Prevent this next time
- Keep schema and RLS policies in migrations (`supabase migration new`) instead of editing production by hand.
- Test each policy as both an anonymous and a signed-in user before shipping.
FAQ
What does "Supabase select returns an empty array (no error)" mean?
With RLS enabled and no SELECT policy matching the user, Postgres silently filters out all rows. No error is raised.
What usually causes it?
RLS enabled with no SELECT policy. Policy restricts to authenticated but the request is anonymous. Querying the wrong schema or table name.
How do I fix it?
1. Add a select policy: 2. For public data, allow anon reads explicitly: 3. Test in the SQL editor's role switcher, or check the user session in the client.
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy