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.

Last edited October 18, 2026

On this page

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.

Supabase Launch Safety Pack

RLS checklist, policy templates, key migration and environment variable setup.

See what’s inside

Secure checkout by Stripe

One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.

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 authenticated users, but the visitor isn't signed in (or their session expired, so auth.uid() is null).
  • The policy compares auth.uid() to a user_id column that's empty or holds a different value.

How to fix it, step by step

  1. Supabase dashboard → Table Editor → select the table and check whether RLS is enabled and what policies exist (or Database → Policies).
  2. Decide who should see the rows:
    • Public data (e.g. product list): add a SELECT policy for anon, authenticated with using (true).
    • Each user's own data: add a SELECT policy for authenticated with using ((select auth.uid()) = user_id).
  3. 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 );
  1. Make sure rows actually have the correct user_id filled in when created.
  2. Don't fix this by turning RLS off or by putting the secret/service_role key in the browser; that exposes all your data.
  3. 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.

    A reload that suddenly shows rows is the session case: Supabase data loads only after a refresh. An insert that fails only when you chain .select() is insert works, .select() returns 42501. A broken image URL is Supabase Storage images not loading.

    Asking for one row with .single() when the query is empty is a different response. See Supabase PGRST116: the result contains 0 rows.

    Sources

    Tool to consider: Supabase.

    Supabase Launch Safety Pack

    RLS checklist, policy templates, key migration and environment variable setup.

    See what’s inside

    Secure checkout by Stripe

    One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.