Category: Supabase and databases

Supabase: Permission Denied for Schema public

Read this guide in Polish

The API request ends with a permission denied for scheme public, although RLS policies look correct. GRANT permissions for the scheme and objects are checked independently of row-level security filters.

How to determine the source of the error

Check the USAGE ON SCHEMA grant and the corresponding table permissions for the roles used by Data API.

Separate the refusal at scheme level from the lack of a right to a specific row.

What to do step by step

1. Restore only the required grants for selected diagrams and tables according to the user role.

2 . Verify RLS policies after changing grants, because correct GRANT without RLS can expand access more than planned.

How to check the score

The legitimate demands work and the role of anon does not gain access to private tables.

What to do

Do not broadcast public USGE and SELECT to all roles without audit exposed schemes.