postgrest exception: Function is restricted to service role
I'm currently using supabase-py version 2.18 and with the following setup:
I'm getting the following error:
for a function that has the following guard:
I've logged the url and key and confirmed that the values are correct. I've also tried providing the key as a Bearer token in the authorization header but that returns a different error.
What am I missing here to initialize a client with the service role and run this function?
What am I missing here to initialize a client with the service role and run this function?
2 Replies
Is that the error message from your function?
Look in the API Gateway log. It shows the role making the call.
Thanks for pointing that out, new to Supabase and wasn't aware that was something I could look at. I was getting a 400 error and after removing a duplicate function with different params which I suspect was being called it now works.