error 500 trying to create a user

hey, im trying to add an admin user on my site that i built with loveable, ofc i intergrated it with supabase but whenever i try to add/ invite a user i get error of database or 500, also on my site it doesnt seem to work properly 🙁
10 Replies
garyaustin
garyaustin2mo ago
Please look in the Auth and Postgres logs of the dashboard.
If the 500 error is database error then you likely have a trigger function being called on auth.users to set up a profile table that is not working.
ניסים פאנג׳ויה
ok, what do i need to do to fix it? create a function?
garyaustin
garyaustin2mo ago
No idea as I don't know what the issue is and am giving you info to find out. What is the error from the Postgres log if there is one? Are you doing a trigger function?
garyaustin
garyaustin2mo ago
Seems you do have a trigger function and it has an error in it. You can see what function by looking in the Database Tab then triggers and select the auth schema. See if there is a trigger on auth.users you or your AI added.
ניסים פאנג׳ויה
ok im here seems like its read only and i cant change anything
garyaustin
garyaustin2mo ago
So you have 3 trigger functions... That is a lot and you appear to be calling the same function twice which is not good.
ניסים פאנג׳ויה
i see so i actually need only one user for my site - an admin account when im trying to create it manually through the auth tab it still seems to not work, prolly because of those functions what do i need to do to fix it?
garyaustin
garyaustin2mo ago
DROP trigger on_auth_user_created ON auth.users in the SQL editor is how you drop them. The triggers that is. Then you go to the functions tab to fix the functions if needed after dropping the triggers you don't want. I have no idea though which ones you need. You likely will need to combine your trigger/function pair to one that does everything you need on the insert. If you have two insert triggers you can't easily guarantee the order they run and only one of them can insert a new row into your profile table if that is what you are doing.

Did you find this page helpful?