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
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?You mean to the auth users? Or to my normal users table?
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.
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?
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 hahaI 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.
Is there a way to add fields to the
auth.users
table without running into that?
Is that common? I wanted to add org.idNo. You can't touch the auth schema.
Awww that's no fun haha
You can add to app_metadata
Awww might look into that
Or create a user-org table and use that for RLS.
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
Because you have to deal with json structures to use app metadata not clear cut.
Do you need the org in the jwt?
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 triedhttps://github.com/GaryAustin1/custom-properties
Has some stuff I was looking at, mainly focused on the proper RLS to use.
I wanted to append users into an array based on their org when they joined. And i'll check that out for sure.
Don't do that.
Use a table with user_id, org.
User_id as the primary key?
Look at my code.
Which one?
org is just a type of property, but I also show a teams.
Depends. roles/properties is simple.
Ohhhh ok ok I see
teams has groups has group owners
Do I even need an ID for Org or can I just use domain?
I used the name for roles, although have a role/name table to verify the role name is real. (role can be org)
Ok cool cool I think I know what I'm going to do now. thank's Gary!
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
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
deleting what?
The field that is giving me the error
Does your auth.users have a verified column? Mine don't.
No that i know
But its giving me that error
I have a verified column on my users table
But not in auth
Do you have a delete trigger on auth.users?
I dont have any triggers
Can you go to database/tables/columns and see if there is a verified column in auth.users?
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?
If you added that column.
I didnt do it consciously then
I dont even know how to add to auth a column
I just checked a 6 month old instance and a minutes old instance and it is not there. How old is your instance?
1.5 months
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?
No there is no data
No
K. If it were me I would delete it.
I might have added it by mistkae idk
Im deleting it
Thanks for your help!