Supabase query returns an empty array with no error, but the rows are in the Table Editor: what to check

Run a free check: FlowWatch signs up, logs in and runs a Stripe test checkout on your app, then scans for exposed keys. You get a shareable report. Run the free check at flowwatch.org

Your Lovable, Bolt or Cursor app shows an empty dashboard. In the browser, supabase.from('projects').select() comes back with data: [] and error: null. But when you open the Supabase Table Editor, the rows are right there.

Nothing is broken in the usual sense. In almost every case this is Row Level Security (RLS) filtering the rows out, and RLS does that silently.

Why there's no error

Supabase's RLS docs describe a policy as an extra WHERE clause that Postgres adds to every query. If no policy lets the current user see a row, the row is simply left out. The docs spell out which denials raise an error and which don't:

What blocks the requestWhat your app sees
A missing table grant for anon or authenticatedError 42501 (permission denied)
A WITH CHECK violation on insert or updateError 42501
A USING clause that filters the row out (including "RLS on, no policy")No error, zero rows

Also from the docs: once RLS is enabled, no data is reachable through the API with the public (anon/publishable) key until you create policies.

The Table Editor and SQL Editor in the dashboard run as a privileged database role, not as your user, so they show every row. That's why the data "is there" in the dashboard and "isn't there" in the app.

Step 1: Confirm it's RLS (2 minutes)

Open your live app, DevTools → Network, reload, and click the request to …supabase.co/rest/v1/<table>.

  • Status 200, body [] → RLS (or a filter) is removing the rows. Keep going.
  • Status 401/403 or 42501 in the body → a grant or auth problem, not silent filtering. Check that the table grants select to the role the app uses.
  • No request to /rest/v1/<table> at all → the component never ran the query, or it hit a different Supabase project. Compare the …supabase.co host with the project you opened in the dashboard.

Then look at the request headers. If the Authorization bearer token is the same as the apikey header, the query ran without a signed-in user (as anon). That leads to Step 3.

Step 2: Check there is a SELECT policy that matches

In the dashboard, open Authentication → Policies (or Database → Policies) for the table.

  • RLS enabled, no policies at all? Nothing is readable through the API. Add a policy.
  • Policies exist, but none for SELECT (or ALL)? Inserts may work while reads return []. Add a SELECT policy.
  • A SELECT policy to authenticated? It never matches for signed-out requests. That's correct for private data, but it means the user must be signed in when the query runs (Step 3).

The usual policy for "users see their own rows":

create policy "Users can view their own rows"
on public.projects for select
to authenticated
using ( (select auth.uid()) = user_id );

Don't "fix" it with using (true). That makes every row readable by everyone the policy applies to, which is how many AI-built apps end up leaking data.

Step 3: Make sure the user is signed in when the query runs

A common cause in AI-built React apps: the page fetches data on first render, before supabase-js has restored the session from storage. That first request goes out as anon, the to authenticated policy doesn't match, and you get []. A refresh sometimes "fixes" it, which makes it look random.

Wait for the session before you query:

const { data: { session } } = await supabase.auth.getSession();
if (!session) {
  // show the login screen, don't query private tables yet
}

or run the fetch from onAuthStateChange once you have a session (INITIAL_SESSION or SIGNED_IN). Also make sure the whole app uses one Supabase client, so the signed-in session is the one your queries use.

Step 4: Check the rows actually belong to this user

The policy compares auth.uid() with a column such as user_id. If that column is empty or holds another ID, the policy correctly hides the row. Look at the rows in the Table Editor:

  • user_id is null. Rows were inserted by a seed script, the SQL editor, a server function using the service key, or an insert that never set user_id. Set it on insert (or give the column a default of auth.uid()), and backfill the old rows.
  • user_id holds a different ID. For example, the app saves a profiles.id while the policy compares with auth.uid(), or the data was created in another Supabase project. Compare the value with the user's ID under Authentication → Users.

Step 5: Test the policy as a real user, without the app

In the SQL Editor, run the query as the authenticated role with that user's ID, inside a transaction:

begin;
set local role authenticated;
select set_config('request.jwt.claims', '{"sub":"<user-uuid>","role":"authenticated"}', true);
select * from public.projects;   -- what this user can see
rollback;

If this returns the rows, the policy is fine and the problem is in the app (Steps 1 and 3). If it returns nothing, fix the policy or the data (Steps 2 and 4).

Related symptoms with the same cause

  • .single() fails with PGRST116 ("JSON object requested, multiple (or no) rows returned"). Often it's the same RLS filtering, showing up as an error because .single() expects exactly one row.
  • An update "succeeds" but nothing changes. The Supabase docs note that an UPDATE needs a matching SELECT policy. Without it, the update matches zero rows and returns no error.
  • Inserts fail with "new row violates row-level security policy": see Why aren't my form submissions saving to Supabase?

Don't trade one bug for a worse one

Turning RLS off, or adding using (true), makes the empty array go away. It also lets anyone with your public key read the table. Before you ship any RLS change, test it three ways: logged out (private tables should return []), as user A (sees only A's rows), and as user B requesting A's row by ID (should get nothing). More in How to check RLS is actually protecting your tables.

Quick checklist

  • The /rest/v1/<table> request returns 200 with [] (not a 401/403 or 42501)
  • The request carried a user token, not just the anon key
  • The table has a SELECT policy that matches signed-in users
  • The app waits for the session before querying private tables
  • user_id (or your owner column) is set and matches auth.uid()
  • Tested the policy as the authenticated role in the SQL Editor
  • Re-tested logged out and as a second user after the fix

Catch it before users email you

FlowWatch signs up, logs in and logs out on your live app every day, runs a Stripe test-mode checkout, and emails you when a step breaks and again when it recovers. The first check is free. Run the free check at flowwatch.org


Sources: Supabase docs, Row Level Security (policies act as an implicit WHERE clause; with RLS enabled no data is accessible through the API with a publishable key until policies exist; a missing grant or WITH CHECK violation raises 42501, while a USING clause that filters rows raises nothing and matches zero rows; UPDATE needs a matching SELECT policy; views bypass RLS unless security_invoker = true; wrap auth.uid() in select): https://supabase.com/docs/guides/database/postgres/row-level-security; Supabase JavaScript reference (getSession, onAuthStateChange): https://supabase.com/docs/reference/javascript/auth-getsession.

Questions: hello@flowwatch.org