OP
Project URL: https://xbygmnlimtbeihnobkbq.supabase.co/
Problem Description
The auth.users table has corrupted records with NULL confirmation_token values. This corruption is causing the Supabase Admin API's listUsers() function to fail consistently with the error:
"Database error finding users"
This prevents all user management operations in our application, including:
Listing existing users in the admin panel
Inviting new users
Bulk user operations
Any automated cleanup attempts
Root Cause
During development, some test user invitations were created that resulted in incomplete auth.users records. These records have NULL values in the confirmation_token column, which appears to break the Admin API's ability to enumerate users.
Attempted Solutions (All Failed)
Bulk Delete via Admin API - Fails because listUsers() cannot enumerate users
Orphaned Users Cleanup Tool - Same issue, relies on listUsers()
Application-level cleanup - Cannot access auth schema directly from application code
Valid Users to PRESERVE
Our public.profiles table is clean and contains only these 3 valid users that MUST be preserved:
Requested Action
Please perform direct database cleanup on the auth.users table to:
1. Identify corrupted records
2. Delete orphaned/corrupted records while preserving the 3 valid users listed above
3. Verify cleanup by confirming listUsers() API works again
Post-Cleanup Verification
After cleanup, I need to verify:
Admin panel can list users successfully
New user invitations work correctly