© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
4 replies
Anonymous_anonymous;)

Help with Supabase Trigger: Permission Denied for Anon Role on auth.users Table

Hello,

I'm new to Supabase and SQL, and while I'm slowly getting the hang of it, I've been stuck on this issue for days and could really use some help.

What I'm Trying to Solve
I’m building an iOS app and creating a login system. I want to take newly inserted information from the auth.users table (specifically, ID, email, and password) and copy it into a table in the public schema (p_users).

Below, I’ve included the simple function and trigger I’m using to handle this.

The Issue
-I’m using the anon key for the app, so the anon role is being used.
-When I manually insert rows into the auth.users table as the postgres role, everything works fine, and the data gets inserted into the p_users table via the trigger.
-However, when the app (under the anon role) inserts into auth.users, I get the following error:

ERROR: 42501: permission denied for table users

I tried creating a policy that allows the anon role to insert into the auth.users table, but it’s not working.

Additional Observations:
If I disable the trigger, the app can successfully insert into the auth.users table as the anon role, but no data gets copied into the p_users table (as expected without the trigger).

Error Logs

API Gateway Log:
POST | 500 | 96.56.181.14 | 900faace3bbf42a9 | https://pqnlwvndpizjspdplftc.supabase.co/auth/v1/signup | Chomped_App

Auth Log:
500: Database error saving new user

I’d appreciate any guidance on what I might be missing or need to fix to allow the trigger to work with the anon role. Thank you in advance for your help!
Screenshot_2025-01-12_at_3.32.01_PM.png
Screenshot_2025-01-12_at_3.32.39_PM.png
Screenshot_2025-01-12_at_3.33.20_PM.png
Screenshot_2025-01-12_at_3.33.37_PM.png
Screenshot_2025-01-12_at_3.33.51_PM.png
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

permission denied for table users
SupabaseSSupabase / help-and-questions
3mo ago
Trigger on auth.users causes permission denied for schema public
SupabaseSSupabase / help-and-questions
3y ago
Need help with anon role
SupabaseSSupabase / help-and-questions
3y ago
Problem with trigger on auth.users
SupabaseSSupabase / help-and-questions
8mo ago