Supabase "permission denied for table" (42501) After Oct 30: Missing GRANT, Not Broken RLS
Your Lovable, Bolt or Cursor app worked yesterday. You added a new table, redeployed, and the browser console now shows:
{
"code": "42501",
"message": "permission denied for table your_table",
"hint": "Grant the required privileges to the current role with: GRANT SELECT ON public.your_table TO anon;"
}
That is not the same error as “new row violates row-level security policy”, even though both use code 42501. This one means Postgres stopped the request before any Row Level Security policy ran: the role your app is using (anon or authenticated) has no grant on the table. (Supabase changelog: tables not exposed automatically)
What changed on October 30, 2026
Until recently, a new table in the public schema usually got select, insert, update and delete for anon, authenticated and service_role automatically. Every new table was reachable through the Data API (supabase-js, REST, GraphQL) the moment you created it.
Supabase rolled that back in stages. On October 30, 2026 the new behavior was applied to existing projects: new tables in public stay invisible to the Data API until you add an explicit GRANT. Existing tables keep whatever grants they already had. Direct Postgres connections (psql, an ORM with a connection string) are unaffected. (Supabase changelog · Supabase: Securing your API)
If you only talk to Postgres over a direct connection, you can stop here. If your browser or Edge Function uses supabase.from('…'), keep reading.
Grants vs RLS (same error code, different lock)
Postgres checks two layers:
- Grants decide whether a role may touch the table at all.
- Policies (RLS) decide which rows that role may see or change.
| Message you see | Which lock failed | Usual fix |
|---|---|---|
permission denied for table … | Missing grant | GRANT the operations that role needs |
new row violates row-level security policy | Missing or failing policy | Add or fix the policy; do not turn RLS off |
If you are chasing an RLS policy violation instead, use Fix Supabase “new row violates row-level security policy”. If RLS itself is new to you, start with Supabase Row Level Security for Beginners.
Step 1: confirm it is a new table
Existing tables were not stripped of grants on October 30. So ask:
- Was this table created (or recreated) after the change hit your project?
- Did an AI tool generate a fresh
create tablein a migration without anygrantlines?
If the table is older and suddenly fails, check whether someone revoked grants, or whether the request is using a different role than you think. Otherwise treat it as a missing grant.
Step 2: see who is asking
In the browser, right above the failing call:
const { data: { user } } = await supabase.auth.getUser();
console.log('Signed in as:', user?.id ?? 'NOBODY (anon)');
NOBODYmeans the request runs asanon.- An id means it runs as
authenticated.
Grant only what that role needs. Do not paste grant all on … to anon as a shortcut.
Step 3: grant, enable RLS, add policies (one unit)
Supabase’s own remediation treats these three steps as a unit. Paste into the SQL Editor, swap your_table and the column names, then run:
-- 1. Privileges the Data API roles need (skip anon unless signed-out visitors must hit this table)
grant select, insert, update, delete on public.your_table to authenticated;
grant select, insert, update, delete on public.your_table to service_role;
-- Only if public, signed-out reads are intentional:
-- grant select on public.your_table to anon;
-- 2. Turn RLS on (grants alone are not enough)
alter table public.your_table enable row level security;
-- 3. Policies for the operations you granted
create policy "users can read their own rows"
on public.your_table
for select
to authenticated
using ( (select auth.uid()) = user_id );
create policy "users can insert their own rows"
on public.your_table
for insert
to authenticated
with check ( (select auth.uid()) = user_id );
That pattern matches Supabase’s changelog example, minus an automatic anon grant. Add anon only when a signed-out visitor truly needs that table. (Supabase changelog · Supabase: Securing your API)
Step 4: teach your AI tool
If Lovable, Bolt or Cursor created the table, the next migration will repeat the mistake unless the tool includes grants. Update the project rules (or Cursor rules file) with something like:
When creating a new Supabase table in public that the Data API must reach:
1. GRANT only the needed privileges to authenticated (and anon only if required).
2. ENABLE ROW LEVEL SECURITY.
3. ADD policies for each command you granted.
Never suggest disabling RLS to clear a 42501 error.
Supabase also ships an agent skill that keeps the grants step current. Prefer that over one-off chat fixes. (Supabase changelog)
Quick checklist
- Error text is
permission denied for table, notnew row violates row-level security policy - Table was created after the Oct 30 change (or after you opted into the new defaults)
- You know whether the failing call is
anonorauthenticated - You granted only the operations that role needs
- RLS is on, with a real policy for each granted command
- You did not turn RLS off and did not
grant all … to anon
Still stuck?
- Read the
hintfield in the JSON error. It names the exactGRANTPostgres wants. - In the dashboard, check the table’s Data API exposure badge and Security Advisor for remediation SQL.
- If inserts still fail after grants, switch to the RLS policy guide.
- Before you share the app, run the pre-launch security checklist.
Official sources used: Supabase changelog: Breaking Change: Tables not exposed to Data and GraphQL API automatically · Supabase: Securing your API · Supabase: Row Level Security · Supabase: Database API 42501 errors. Checked November 2026.
Ready to ship without guessing the next fix?
The Ship It Kit puts the prompts, deploy steps and pre-launch checklist in one place for Lovable, Bolt, Cursor and Replit apps. One-time $19. Launch price: $19 $17 until November 14, 2026.