Updated November 25, 2026 · by Valmir, founder of Publishub
Short answer
supabase-js doesn't throw when an insert fails: it returns an error object, and if the code ignores it, the app shows "Saved!" anyway. The most common cause is row-level security (RLS): the table has RLS enabled but no policy that allows this user to insert, so Postgres rejects the row with "new row violates row-level security policy". Check the error, add an insert policy, and read the data back to confirm.
Step 1: stop ignoring the error #
- 01Look at what the insert returns Every Supabase call returns { data, error }. Show the error instead of the success message when it's set. AI-generated code often skips this check.
const { error } = await supabase.from("notes").insert({ title, user_id: user.id });
if (error) {
console.error(error);
showError("Couldn't save. Please try again.");
return;
}
showSuccess("Saved!");
- 02Read the message Open the browser console and the Network tab, save again and look at the failed request. The error message tells you which of the causes below you have.
Step 2: fix the cause #
- 01"new row violates row-level security policy" (RLS) RLS is on and no policy allows the insert. Add one that lets logged-in users insert rows they own, in the Supabase SQL editor:
create policy "Users can insert their own notes"
on public.notes for insert
to authenticated
with check (auth.uid() = user_id);
- 02The insert works but data comes back empty If the code calls .insert(...).select() and there's no select policy, the row is saved but can't be read back. Add a matching policy for select (using (auth.uid() = user_id)).
- 03"Could not find the column" The code sends a field name the table doesn't have, often after the AI renamed something on one side only. Make the names match the table in Supabase's Table Editor.
- 04The user isn't logged in With RLS, a request without a session runs as the anon role and fails policies meant for authenticated users. Check that the session exists before saving.
Step 3: prove it saved #
After the fix, save something, reload the page and confirm it's still there, or check the table in Supabase. Then test with a second account: it should not see the first account's rows. That last check catches the opposite mistake, a policy so open that everyone can read everything.
To catch this automatically after every change, run a journey that saves something and reads it back. stillworks, a free open-source tool, has a ready-made "read the data back" recipe for exactly this case.
Free tool · No signup
Check your app now, in about a minute #
Paste your app's URL. We open it in a real browser and show JavaScript crashes, failed requests and broken pages. Read-only: we never log in or submit forms.
Questions #
Should I just disable RLS to make it work? #
Why does it work in the Supabase dashboard but not in my app? #
Stop checking by hand after every AI change #
Publishub is building the full version: your sign-up, login and checkout journeys, run in a real browser after every deploy and compared with the last version that worked. It's in development; the waitlist is open.