I can't delete auth user

When trying to delete a user (previously i had deleted that user reference in every table) I get an error "Failed to delete user: property verified should not exist". Thanks!
45 Replies
jdbohrman
jdbohrman2y ago
Did you try to add a field to the user that wasn't originally there? Because that's usually what it is When it happened to me it was because I added an org_id field. So I had to run a DROP statement to remove that extra column. @garyaustin can you verify?
Bruno0
Bruno0OP2y ago
You mean to the auth users? Or to my normal users table?
garyaustin
garyaustin2y ago
Yes, auth.users is what he was asking. Go checks the json data structure of user and also I think some of OAuth info in the identities table.
Bruno0
Bruno0OP2y ago
I can't find anything, what would Id be loooking for? And @jdbohrman said doing a drop, a drop to my auth deleting "verified" field? Is that even possible?
jdbohrman
jdbohrman2y ago
Did you add a field to the auth.users table? Yes you can drop fields from the auth.users table. But I would only suggest doing so if they are ones you know you've created yourself It's so funny I saw this because I literally just experienced this haha
garyaustin
garyaustin2y ago
I did notice there is a verified json key for some of the OAuth providers. I BELIEVE that if Go loads those it might also generate that error IF it is not expecting that OAuth provider to have a verified key. But that is speculation on my part as that error does not exist in the source code.
jdbohrman
jdbohrman2y ago
Is there a way to add fields to the auth.users table without running into that? Is that common? I wanted to add org.id
garyaustin
garyaustin2y ago
No. You can't touch the auth schema.
jdbohrman
jdbohrman2y ago
Awww that's no fun haha
garyaustin
garyaustin2y ago
You can add to app_metadata
jdbohrman
jdbohrman2y ago
Awww might look into that
garyaustin
garyaustin2y ago
Or create a user-org table and use that for RLS.
jdbohrman
jdbohrman2y ago
I'd got a org table but I thought it might be easier management wise to just have those fields as extra parts of auth
garyaustin
garyaustin2y ago
Because you have to deal with json structures to use app metadata not clear cut. Do you need the org in the jwt?
jdbohrman
jdbohrman2y ago
Makes sense. Not exactly, but I can't seem to figure out how to get the auth.user to insert into my organizations.members array, which was the first method I tried
garyaustin
garyaustin2y ago
https://github.com/GaryAustin1/custom-properties Has some stuff I was looking at, mainly focused on the proper RLS to use.
jdbohrman
jdbohrman2y ago
I wanted to append users into an array based on their org when they joined. And i'll check that out for sure.
garyaustin
garyaustin2y ago
Don't do that. Use a table with user_id, org.
jdbohrman
jdbohrman2y ago
User_id as the primary key?
garyaustin
garyaustin2y ago
Look at my code.
jdbohrman
jdbohrman2y ago
Which one?
garyaustin
garyaustin2y ago
org is just a type of property, but I also show a teams. Depends. roles/properties is simple.
jdbohrman
jdbohrman2y ago
Ohhhh ok ok I see
garyaustin
garyaustin2y ago
teams has groups has group owners
jdbohrman
jdbohrman2y ago
Do I even need an ID for Org or can I just use domain?
garyaustin
garyaustin2y ago
I used the name for roles, although have a role/name table to verify the role name is real. (role can be org)
jdbohrman
jdbohrman2y ago
Ok cool cool I think I know what I'm going to do now. thank's Gary!
garyaustin
garyaustin2y ago
The roles example is just a simple version of the properties example which can be lots of things, but it is just a "class" to name things. Groups is more advanced with owners of groups, but I only got started on it and still need to finish. This is a more advanced one: https://github.com/point-source/supabase-tenant-rbac
Bruno0
Bruno0OP2y ago
I didnt create any field, because i don't even know how to add a field to auth. So im going to run a drop deleting that, hope it doesnt crash all my project
garyaustin
garyaustin2y ago
deleting what?
Bruno0
Bruno0OP2y ago
The field that is giving me the error
garyaustin
garyaustin2y ago
Does your auth.users have a verified column? Mine don't.
Bruno0
Bruno0OP2y ago
No that i know But its giving me that error I have a verified column on my users table But not in auth
garyaustin
garyaustin2y ago
Do you have a delete trigger on auth.users?
Bruno0
Bruno0OP2y ago
I dont have any triggers
garyaustin
garyaustin2y ago
Can you go to database/tables/columns and see if there is a verified column in auth.users?
Bruno0
Bruno0OP2y ago
Wait yes there is I didnt see it Okay i can solve the error running a drop But how did that column get in there?
garyaustin
garyaustin2y ago
If you added that column.
Bruno0
Bruno0OP2y ago
I didnt do it consciously then I dont even know how to add to auth a column
garyaustin
garyaustin2y ago
I just checked a 6 month old instance and a minutes old instance and it is not there. How old is your instance?
Bruno0
Bruno0OP2y ago
1.5 months
garyaustin
garyaustin2y ago
Sometimes the auth schema can get out of sync with the gotrue version especially on local dev versions. But since I don't see it the past 6 months.... it is likely you somehow added it. Can you go to the table UI, select auth schema and see if there is data in the column? I highly suspect you accidentally created it messing with your public.users table if it is also called 'users'. Do you use Prisma?
Bruno0
Bruno0OP2y ago
No there is no data No
garyaustin
garyaustin2y ago
K. If it were me I would delete it.
Bruno0
Bruno0OP2y ago
I might have added it by mistkae idk Im deleting it Thanks for your help!

Did you find this page helpful?