Why Supabase queries return empty results with no error: three common causes
A Supabase query that returns an empty array without any error is most often caused by Row Level Security (RLS), since the SQL Editor bypasses it while the app runs as anon or authenticated users. The article reproduces the issue with a local script in which a signed-in user sees zero rows while a direct count shows five. The three common causes are enabling RLS without creating a select policy, writing a policy that compares the note's id instead of the owner column with auth.uid(), and querying before the user's session is ready. Each has a suggested fix, such as adding a correct policy, comparing the owner column, or checking the user before querying. The author also advises against disabling RLS or shipping the service_role key to the browser, since both remove the protection rather than fix the problem.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in