supabase-community/supabase-custom-claims

Postgres 15

barbinbrad opened this issue · 4 comments

Bug report

Describe the bug

After upgrading to Postgres 15 an rpc call to get_claims gives the following response:

{
  error: null,
  data: {
    error:  'access denied'
  },
  count: null,
  status: 200,
  statusText: 'OK'
}

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Install the latest version of supabase and supabase-js.
  2. Run supabase.rpc("get_claims", { uid })

Expected behavior

Expect the claims from app_metadata to be returned.

From what I can tell, the problem is with the is_claims_admin() function. If I remove the is_claims_admin() check from get_claims and get_claim -- I am unblocked, but I have a feeling this is not the "right" way. Any advice?

getting the same like you when using "set_claim" in rpc (My supabase client has a service role key)

getting the same like you when using "set_claim" in rpc (My supabase client has a service role key)

For set_claims this is what I've been doing instead:

getSupabaseServiceRole().auth.admin.updateUserById(userId, {
    app_metadata: claims,
  });

You can also try upgrading your supabase CLI -- as there was a bug in there that only surfaced when running locally.

Any news on this? I seem to have stumbled on the same.