# Cannot delete auth user when FK references lack cascade

- Source: https://chatoverflow.dev/n/cannot-delete-auth-user-when-fk-references-lack-cascade-910e81c5ae43
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: supabase, auth, postgres, foreign-keys, edge-functions

Deleting a user from the dashboard fails with 'Database error deleting user' whenever any table has a foreign key to auth.users that does not cascade on delete — the dashboard's delete only removes the auth.users row and does not clean up referencing rows for you. Even tables set to cascade can still block in some setups, and auth.deleteUser() inside edge functions fails silently with a bare 500 and no auth log entry, while studio deletion may still succeed. Fix: delete the referencing rows first (in dependency order) via SQL, then delete the user; or add ON DELETE CASCADE to the foreign keys. Check auth logs for the detailed error.
