Short answer: From 30 October 2026, Supabase stops giving new tables access to its API by default. So when Lovable adds a new table, your app can't reach it. You get permission denied for table (error 42501), even if your RLS policies are right. The fix is a GRANT on that one table, with RLS still on. Your old tables are fine. Then add one line to your Lovable project instructions so the next new table doesn't break the same way.
What changed
Before, every new table in the public schema got access for three roles straight away:
anon: people who aren't signed inauthenticated: people who are signed inservice_role: server code, like Edge Functions
That's why a new table used to "just work".
Supabase says that from 30 October 2026, this stops on all existing projects. A new table in public gets no access for those roles until you grant it. It started rolling out to new projects on 30 May 2026. (Supabase changelog)
Two things don't change:
- Old tables keep working. Tables you already have keep their access.
- RLS works the same. A grant decides if a role can touch the table at all. RLS decides which rows it can see. You need both.
Not affected (per the same changelog):
- Apps that only use a direct Postgres connection (a connection string, psql or an ORM on a server). Lovable apps use supabase-js, so they are affected.
- Tables in the
storage,authandrealtimeschemas, and custom schemas. If your error is about uploads or sign-in, this change is probably not the cause.
Is it you?
It's probably you if all of these are true:
- Your app uses Supabase through
supabase-js. Every Lovable + Supabase app does. - You, or Lovable, added a new table on or after 30 October.
- The new feature fails, but older pages still work.
To check, open your live app. Right click, choose Inspect, then open the Network tab. Try the action again. Click the failed request to /rest/v1/your_table. You'll see something like:
{
"code": "42501",
"message": "permission denied for table orders",
"hint": "Grant the required privileges to the current role with: GRANT SELECT ON public.orders TO anon;"
}Look for the message permission denied for table, not just the code. The hint tells you which role is missing which access.
You can also check the table in the Supabase SQL Editor. Change orders to your table name:
select grantee, privilege_type
from information_schema.role_table_grants
where table_schema = 'public' and table_name = 'orders';If anon or authenticated aren't in the list, the table has no API access. (Supabase: Database API 42501 errors)
In the dashboard, Supabase says the Data API exposure badge in the Table Editor and the Security Advisor both list tables worth reviewing, and the Security Advisor shows the SQL to fix them.
Not this problem: the same code, 42501, is also used when RLS blocks a save. If the message says new row violates row-level security policy, that's an RLS policy blocking the row, and a grant won't fix it. See our new row violates row-level security policy page. If you get an empty list and no error, that's usually an RLS policy, not a missing grant.
The fix
Do these three steps together, in one migration. Supabase says to treat them as one unit. Change orders to your table name.
1. Grant only what the app needs, on that one table.
Most Lovable apps have users sign in. So the role is usually authenticated:
grant select, insert, update, delete on table public.orders to authenticated;Only grant to anon if signed-out visitors must see this table, like a public product list. Read access is usually all they need:
grant select on table public.products to anon;If an Edge Function or other server code uses this table with the service role key, grant service_role too. The service role skips RLS, but it still needs the grant:
grant select, insert, update, delete on table public.orders to service_role;2. Make sure RLS is on.
alter table public.orders enable row level security;It's safe to run even if RLS is already on.
3. Make sure the table has policies.
A grant without RLS lets anyone with your public key reach every row. So check the table has policies that match how the app uses it. For "each user sees only their own rows":
create policy "Users can read their own orders"
on public.orders for select to authenticated
using ((select auth.uid()) = user_id);
create policy "Users can add their own orders"
on public.orders for insert to authenticated
with check ((select auth.uid()) = user_id);Change user_id to the column that holds the owner's ID. Skip any policy the table already has.
If saving then says permission denied for sequence: the table uses a numbered ID. Grant use of that one sequence to the same role, for example:
grant usage, select on sequence public.orders_id_seq to authenticated;Reload the page that failed and try again.
Stop it happening on the next table
The fix above covers one table. The next time Lovable adds a table, it can break the same way. Supabase's own advice is to make the grant part of how your AI tool creates tables.
In Lovable, open Project settings > Instructions and add:
When you create a new Supabase table in the public schema, put these in the same migration: enable row level security, add the policies the app needs, and grant only the privileges the app uses on that one table (usually to authenticated; to anon only if signed-out visitors must read it; to service_role if an Edge Function uses it). Never grant on all tables, never use alter default privileges, and never turn off row level security.
Lovable includes project instructions on every message, so you don't have to repeat it. (Lovable: Instructions)
What not to do
- Don't grant on every table.
grant ... on all tables in schema publicopens all your tables, private ones too. - Don't switch the old default back on with
alter default privileges ... grant. That opens every future table, which is the risk Supabase is removing. - Don't turn RLS off to make the error go away. With a grant and no RLS, anyone with your public key can read and change every row.
- Don't grant write access to
anonunless signed-out visitors really need to write to that table. - Don't put the service role key in the front end. It skips RLS, and anyone can copy it from your site.
Copy-paste Lovable prompt
Swap TABLE_NAME for the table named in the error.
My app gets a Supabase error 42501 "permission denied for table TABLE_NAME". Since 30 October 2026, Supabase no longer gives new tables API access automatically.
Please create one new Supabase migration that:
1. Grants only the privileges the app's code actually uses (select, insert, update, delete) on public.TABLE_NAME to the authenticated role. Only grant select to anon if signed-out visitors must see this table. Never grant write access to anon. If an Edge Function uses this table with the service role, grant the same privileges to service_role.
2. Runs: alter table public.TABLE_NAME enable row level security;
3. Checks the policies on public.TABLE_NAME and adds any that are missing so each user can only reach their own rows (or whatever matches how this table is used). Don't duplicate policies that already exist.
4. If the table uses a numbered ID sequence, grants usage and select on that one sequence to the same roles.
Do not grant on all tables in the public schema, do not use alter default privileges, do not grant to PUBLIC, and do not disable row level security. Don't change any other tables. When you add new tables in future, always include these grants, RLS and policies in the same migration. Tell me exactly which grants and policies you added.For more detail, see our full guide: Supabase's 30 October change: the safe fix.
How to check it's really fixed
- Open the live app in a private window and sign in as a normal test user, not an admin.
- Repeat the action that failed. In the Network tab, the request to
/rest/v1/your_tableshould now return 200 or 201. - Sign in as a second test user. Check they can't see the first user's rows. If they can, the grant worked but a policy is too open. Fix the policy, don't remove the grant.
- Sign out and reload. Only tables you meant to be public should still load.
Still stuck?
Sometimes the grant isn't the only problem. The policy may check the wrong column, a function may need its own grant, or the live app may use another database. Submit your app to ProvenFix. Submit your app free. You only pay if you choose to unlock the fix: US$89 for a Tested fix or US$39 for a Likely fix, in your local currency at checkout. If we agree the fix did not work, contact hello@provenfix.app.
FAQ
Why do I get "permission denied for table" when my RLS policies are right? From 30 October 2026, Supabase doesn't give new tables API access by default. The grant is checked before RLS. With no grant, the request fails before your policies are even used.
Are my old tables affected? No. Supabase says existing tables keep their current access. Only tables added after the change reaches your project need a grant.
Does this affect Storage uploads or sign-in? Not directly. Supabase says tables in the storage, auth and realtime schemas keep their current grants. If an upload fails with a row-level security error, that's a Storage policy. If a new table in public is involved, like a profiles table filled on sign-up, check its grants.
Will Lovable add the grants by itself next time? Don't count on it. Add a rule to your Project instructions (Project settings > Instructions) so every new table gets RLS, policies and the right grants in the same migration.
Which role should I grant to? Usually authenticated, for signed-in users. Only grant select to anon if signed-out visitors must see the table. Grant service_role if an Edge Function uses the table with the service role key.
Is it safe to grant access? Yes, if RLS is on and the table has the right policies. A grant lets the role reach the table. RLS decides which rows it can see. Never grant without RLS.
Should I just grant on all tables, or turn the old default back on? No. That opens every table, including private ones, and every future table too. Grant on the one table that needs it.
Can ProvenFix fix this for me? Yes. Submit your app free. You only pay if you choose to unlock the fix: US$89 for a Tested fix or US$39 for a Likely fix, in your local currency at checkout. If we agree the fix did not work, contact hello@provenfix.app.
Sources
- Supabase changelog, "Breaking Change: Tables not exposed to Data and GraphQL API automatically" (dates, who is affected, the three-step unit, Data API exposure badge, Security Advisor, schemas not affected)
- Supabase docs, Securing your API (grants vs RLS, default privileges)
- Supabase KB, Database API 42501 errors (grant check query; 42501 can also be RLS on INSERT or UPDATE; enable RLS after granting)
- Lovable docs, Instructions (previously Knowledge; Project settings > Instructions; always included in context)
Last checked: December 3, 2026.