Fix send-auth-otp: Remove notification_logs references

- Remove notification_logs table references (table doesn't exist)
- This was causing the function to crash after sending email
- Now the function should complete successfully
- Added better email payload logging
- Keep .env file for local development
This commit is contained in:
dwindown
2026-01-02 15:07:41 +07:00
parent fa1adcf291
commit 08e56a22d8
8 changed files with 421 additions and 31 deletions

30
cleanup-user.sql Normal file
View File

@@ -0,0 +1,30 @@
-- ============================================================================
-- Clean Up User from Supabase Auth Completely
-- ============================================================================
-- NOTE: You CANNOT just DELETE from auth.users
-- Supabase keeps deleted users in a recycle bin
-- To completely remove a user, you need to use Supabase Auth Admin API
-- OR use a cascade delete from a linked table
-- Option 1: Delete via cascade (if you have foreign keys)
-- This works because auth_otps has ON DELETE CASCADE
DELETE FROM auth.users WHERE email = 'your@email.com';
-- Option 2: Check if user still exists in recycle bin
SELECT id, email, deleted_at
FROM auth.users
WHERE email = 'your@email.com';
-- If you see deleted_at IS NOT NULL, the user is in recycle bin
-- To permanently delete from recycle bin, you need to:
-- 1. Go to Supabase Dashboard → Authentication → Users
-- 2. Find the user
-- 3. Click "Permanently delete"
-- OR use the Auth Admin API from an edge function:
/*
const { data, error } = await supabase.auth.admin.deleteUser(userId);
*/