Hosted postgres cannot GRANT USAGE ON SCHEMA auth to a custom NOLOGIN role; need supabase_admin #51357
Replies: 2 comments 1 reply
|
Only Supabase staff can run that You may not need the grant, though. select coalesce(
nullif(current_setting('request.jwt.claim.sub', true), ''),
(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'sub')
)::uuid
A. Read the claim directly in the function owned by B. Wrap create function private.current_uid() returns uuid
language sql stable security definer set search_path = ''
as $$ select auth.uid() $$;
revoke execute on function private.current_uid() from public;
grant usage on schema private to ros_enrichment_executor;
grant execute on function private.current_uid() to ros_enrichment_executor;Both keep your constraints: no ownership change, no role membership, no access to What I checked: I reproduced the privilege setup on a plain PostgreSQL 16 (schema owned by another role, executor with |
|
Agreed that the ticket is the right channel for the literal 1. Read the subject from the transaction GUC instead of calling
|
Uh oh!
There was an error while loading. Please reload this page.
Official support ticket: SU-497097
Project: sentientia-revenue-os (phzssifqkrpdrftxejpy)
A SECURITY DEFINER RPC owned by custom role ros_enrichment_executor needs to call existing auth.uid(). The role already has EXECUTE on auth.uid(), but not USAGE on schema auth, so the call fails with SQLSTATE 42501 permission denied for schema auth.
Please run exactly this as supabase_admin (current owner of schema auth):
GRANT USAGE ON SCHEMA auth TO ros_enrichment_executor;
Verified on this project:
Do not change schema ownership, grant superuser/BYPASSRLS, add role memberships, or grant table privileges on auth.users. Only schema USAGE for that existing role.
All reactions