Add quick deploy checklist for email template fix

This commit is contained in:
dwindown
2026-01-02 15:20:33 +07:00
parent 3196c0ac01
commit da9a68f084

201
DEPLOY-CHECKLIST.md Normal file
View File

@@ -0,0 +1,201 @@
# 🚀 Quick Deploy Checklist
## Current Status
- ✅ Auth page registration works in production
- ✅ Email is being sent
- ❌ Email missing master template wrapper (needs deployment)
## What You Need to Do
### Step 1: Deploy Updated Edge Function (CRITICAL)
The email is sending but without the master template. You need to deploy the updated `send-auth-otp` function.
**Option A: If you have Supabase CLI access**
```bash
ssh root@lovable.backoffice.biz.id
cd /path/to/supabase
supabase functions deploy send-auth-otp
```
**Option B: Manual deployment**
```bash
ssh root@lovable.backoffice.biz.id
# Find the edge functions directory
cd /path/to/supabase/functions
# Backup current version
cp send-auth-otp/index.ts send-auth-otp/index.ts.backup
# Copy new version from your local machine
# (On your local machine)
scp supabase/functions/send-auth-otp/index.ts root@lovable.backoffice.biz.id:/path/to/supabase/functions/send-auth-otp/
# Restart edge function container
docker restart $(docker ps -q --filter 'name=supabase_edge_runtime')
```
**Option C: Git pull + restart**
```bash
ssh root@lovable.backoffice.biz.id
cd /path/to/project
git pull origin main
cp supabase/functions/send-auth-otp/index.ts /path/to/supabase/functions/send-auth-otp/
docker restart $(docker ps -q --filter 'name=supabase_edge_runtime')
```
### Step 2: Verify Deployment
After deployment, test the registration:
1. Go to https://with.dwindi.com/auth
2. Register with a NEW email address
3. Check your email inbox
**Expected Result:**
- ✅ Email has black header with "ACCESS HUB" logo
- ✅ Email has proper brutalist styling
- ✅ OTP code is large and centered
- ✅ Email has footer with unsubscribe links
### Step 3: Confirm Checkout Flow
The checkout page already redirects to auth page for registration, so **no changes needed**.
Verify:
1. Add product to cart
2. Go to checkout
3. If not logged in, redirects to `/auth`
4. Register new account
5. Receive OTP email with proper styling ✅
6. Verify email
7. Login
8. Complete checkout
## What Was Fixed
### Before
```html
<!-- Email was just the content without wrapper -->
<h1>🔐 Verifikasi Email</h1>
<p>Halo {nama},</p>
<div class="otp-box">{otp_code}</div>
```
### After (With Master Template)
```html
<!DOCTYPE html>
<html>
<head>...</head>
<body>
<table>
<!-- Header with ACCESS HUB branding -->
<tr>
<td style="background: #000; padding: 25px 40px;">
ACCESS HUB | NOTIF #123456
</td>
</tr>
<!-- Main content with OTP -->
<tr>
<td>
<div class="email-content">
<h1>🔐 Verifikasi Email</h1>
<p>Halo {nama},</p>
<div class="otp-box">{otp_code}</div>
</div>
</td>
</tr>
<!-- Footer -->
<tr>
<td>
ACCESS HUB
Email ini dikirim otomatis
Unsubscribe
</td>
</tr>
</table>
</body>
</html>
```
## Files Changed
Only ONE file needs to be deployed:
- `supabase/functions/send-auth-otp/index.ts`
**Changes:**
- Added `EmailTemplateRenderer` class (260 lines)
- Updated email body processing to use master template
- No database changes needed
- No frontend changes needed
## Testing After Deployment
```bash
# 1. Register new user
# Go to /auth and fill registration form
# 2. Check OTP was created
# In Supabase SQL Editor:
SELECT * FROM auth_otps ORDER BY created_at DESC LIMIT 1;
# 3. Check email received
# Should have:
# - Black header with "ACCESS HUB"
# - Notification ID (NOTIF #XXXXXX)
# - Large OTP code in dashed box
# - Gray footer with unsubscribe links
# 4. Verify OTP works
# Enter code from email
# Should see: "Verifikasi Berhasil"
```
## Success Criteria
✅ Email has professional brutalist design
✅ ACCESS HUB branding in header
✅ Notification ID visible
✅ OTP code prominently displayed
✅ Footer with unsubscribe links
✅ Responsive on mobile
✅ Works in all email clients
## Rollback Plan (If Something Breaks)
```bash
# If deployment fails, restore backup
ssh root@lovable.backoffice.biz.id
cd /path/to/supabase/functions/send-auth-otp
cp index.ts.backup index.ts
docker restart $(docker ps -q --filter 'name=supabase_edge_runtime')
```
## Need Help?
Check logs:
```bash
docker logs $(docker ps -q --filter 'name=supabase_edge_runtime') | tail -100
```
Test edge function directly:
```bash
curl -X POST https://lovable.backoffice.biz.id/functions/v1/send-auth-otp \
-H "Authorization: Bearer YOUR_SERVICE_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id":"TEST_ID","email":"test@example.com"}'
```
---
## Summary
**Status:** Ready to deploy
**Files to deploy:** 1 (send-auth-otp edge function)
**Risk:** Low (email improvement only)
**Time to deploy:** ~5 minutes
After deployment, test registration with a new email to confirm the email has proper styling!