Data shows in preview but not live? Check your RLS policies
You build an app with a Supabase database behind it. In the builder's preview, the lists fill up, the dashboard shows numbers and saving works. On the live site, real visitors see an empty page, a list with nothing in it, or a form that seems to save but never does. There is no error on screen and often nothing in the console either.
The symptom
- Pages that should show data show "No items yet" or an empty table.
- It works for you, logged in as the owner, but not for a logged-out visitor or a new user.
- Saving or editing appears to succeed, but the row never shows up in the database.
Why it happens
Supabase protects tables with Row Level Security (RLS). When RLS is on, every query is checked against the table's policies. A policy says which role (anon for logged-out visitors, authenticated for signed-in users) may do which action (SELECT, INSERT, UPDATE, DELETE) on which rows.
The catch is what happens when no policy matches. A read doesn't fail: it returns zero rows. Your app treats that as "there's nothing here" and shows an empty state. Writes can be rejected with an error that the app's code swallows, so the visitor sees a success message anyway.
Preview hides this for a few reasons. You are usually logged in, often as the user who created the rows. Some tools run queries with more privileges while you build. And test data you added by hand may belong to your account, so a policy like "users see their own rows" shows it to you and nobody else.
RLS being on is a good thing. A table without it, exposed through the public API key, can be read or changed by anyone. The fix is the right policies, not turning security off.
Step-by-step diagnosis
- Load the page as a stranger. Open the live site in a private window, logged out. Then sign up as a brand-new user and look again. Note which pages are empty for whom.
- Watch the network request. Open the Network tab, reload, and find the request to your Supabase project (it ends in
/rest/v1/and a table name). A 200 status with[]as the body points at a missing or too-strict read policy. - Check writes. Submit a save and look at the response. A 401 or 403, or a message mentioning "row-level security policy", means the insert or update was refused.
- List the policies. In Supabase, open Authentication, then Policies, or the table's settings. For each table the page uses, note whether RLS is enabled and which policies exist for each action and role.
- Test a query as the right role. The SQL editor runs as an admin and ignores RLS, so a query that works there proves nothing. Test through the app, logged out and logged in.
Fixes per builder and host
Supabase directly
- Add a
SELECTpolicy for each table the public is meant to read, for theanonrole, limited to the rows that are meant to be public (for examplepublished = true). - For user data, add policies for
authenticatedthat compare the row's owner column withauth.uid(). - Give
INSERT,UPDATEandDELETEtheir own policies. A read policy doesn't cover writes. - Make sure inserts fill in the owner column, or the "own rows" policy will hide the row right after it's saved.
Lovable
Ask Lovable: "Logged-out visitors see an empty list on the live site. List the RLS policies on the tables this page reads, explain which role each one allows, and add a policy so visitors can read only published rows. Don't disable RLS." Review the SQL it proposes before you approve it.
Bolt
Bolt apps on Supabase need the same policies. Check the migration files Bolt created; policies written there are what reached production.
Replit, v0 and Cursor
If the frontend talks to Supabase with the public key, the same rules apply. Ask your assistant to show every table the page touches and the policy for each action. Never solve it by putting the service role key in the browser: that key bypasses RLS for anyone who opens your site.
How to verify
- Reload the live page in a private window. Public data should appear.
- Sign up as a new user, create something, refresh, and confirm it's still there.
Prevention
- Whenever a new table is added, write its policies in the same change.
- Keep one "stranger test" after each deploy: logged out, then a fresh account.
- Make the app show an error when a write fails, so a blocked insert doesn't look like success.
An empty list isn't always an empty table. Sometimes it's a policy saying no, quietly.
FlowCanary's free check loads your live site as a logged-out visitor and flags blank pages, console errors and broken links, with a fix prompt for your builder. It doesn't read your database, so check policies as above.
