© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
1 reply
good_for_nothing

auth.users triggers throwing error.

Hey I have created a trigger on auth.users but it is throwing an error.

AuthException(message: Database error granting user, statusCode: 500)

CREATE OR REPLACE FUNCTION update_user_to_public()
RETURNS TRIGGER AS $$
BEGIN
UPDATE member
SET email = NEW.email, phone = NEW.phone
WHERE user_id = NEW.id;
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER user_updated_trigger
AFTER UPDATE ON auth.users
FOR EACH ROW
EXECUTE function update_user_to_public();

The trigger only throws error when doing an update, if I comment out the update part and just have a simple trigger with return new; it works fine.
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Manage Auth users
SupabaseSSupabase / help-and-questions
4y ago
Insert many auth.users
SupabaseSSupabase / help-and-questions
4y ago
Clarification on auth.users
SupabaseSSupabase / help-and-questions
4y ago
list all auth.users
SupabaseSSupabase / help-and-questions
4y ago