Auth Failed to delete selected users: User not found

Hi everyone, I’m having trouble deleting a user directly from the Supabase dashboard (Auth > Users). When I select the user and try to delete, I get a “User not found” error, even though the user is clearly listed in the dashboard with a valid UUID and email. I’ve already: Confirmed the user exists and the UUID matches Noticed that users created without the Providers column set to email cannot be deleted from Auth > Users Waited several minutes in case of sync delays Is this a known issue, or is there something else I should check? Any advice would be appreciated! Thanks!
No description
6 Replies
garyaustin
garyaustin2mo ago
How was the user created?
BITW ❌🙅♂
BITW ❌🙅♂OP2mo ago
User was created through a function in my database this is the part from the function where the user is insert into the auth -- Create user in auth.users INSERT INTO auth.users ( id, email, encrypted_password, email_confirmed_at, created_at, updated_at, raw_user_meta_data ) VALUES ( gen_random_uuid(), p_email, crypt(p_password, gen_salt('bf')), now(), now(), now(), jsonb_build_object( 'user_type', p_barber_role, 'user_name', p_barber_name ) ) RETURNING id INTO new_user_id;
BITW ❌🙅♂
BITW ❌🙅♂OP2mo ago
I have 2 users that were created through this function and I can't delete them, I have already deleted them from all my tables but I simply can't delete them from the Auth and the only thing they have different from the other users is that they do not have the Providers column as email.
No description
BITW ❌🙅♂
BITW ❌🙅♂OP2mo ago
I didn’t realize this before, but we shouldn’t create users in Auth via direct inserts. I went ahead and did it, which was a mistake. Now, how can I delete the two users I incorrectly created through inserts? That’s all I want just to remove those users.
garyaustin
garyaustin2mo ago
Try deleting the rows with SQL. Make sure to use WHERE on id or email. You should use admin.createUser to create users. Probably not setting up the provider info and identity table entry casing the issue. But it could be any missing column data.
BITW ❌🙅♂
BITW ❌🙅♂OP2mo ago
It worked using: DELETE FROM auth.users WHERE id = 'USER_ID'; Thank you very much !

Did you find this page helpful?