Rowpass 42501: permission denied for table Not affiliated with Supabase

Rowpass / Guides

Public read-only table

Anyone reads. Only your server writes. Here is the SQL.

-- public.your_table: public read
alter table public.your_table enable row level security;
revoke all on table public.your_table from anon, authenticated;
grant select on table public.your_table to anon;
grant select on table public.your_table to authenticated;
grant select, insert, update, delete on table public.your_table to service_role;
drop policy if exists your_table_read_all on public.your_table;
create policy your_table_read_all on public.your_table
  for select to anon, authenticated
  using ( true );

Line by line

LineWhy
enable row level securityWithout it, a granted table has no row filter at all.
revoke all ... from anon, authenticatedStarts from a known state. Supabase's RLS guide does this before granting back.
grant select ... to anon and authenticatedSigned-out and signed-in requests run as different roles. Both need read.
grant ... to service_roleLets server-side code write the rows.
create policy ... using ( true )Allows every row for the two client roles. Use only for data meant to be public.

Fits: announcements, a product catalogue, published blog posts, lookup tables. Does not fit: anything with an email, a name or a user id in it.

Write the fix for your tables

One table is free. The whole schema with a rollback file is $9 one-time, free during launch.

 

Waiting for a paste.

    Who can reach each table

    Your tables show up here, one row each, with a choice of who can reach them.

    The SQL appears here as soon as a table is found.

    Parsed in your browser. Your SQL is never uploaded, and no site or database is scanned.

    Questions

    Can signed-in users write with this?

    No. They only have select. Use Owner only if users should write their own rows.

    Sources

    Related

    Did it fix your error?