4.9 KiB
4.9 KiB
Deployment Runbook
Scope
- Runtime:
console.svc.plus - Frontend host: Vercel
- Edge: Cloudflare
- Auth backend:
https://accounts.svc.plus
This runbook is the minimum checklist for production incidents where login or MFA stops working and browser devtools show /api/auth/login or /api/auth/mfa/* failures.
Expected Request Flow
- Browser loads
https://console.svc.plus/login - Browser calls same-origin Next routes on
console.svc.plus - Next route proxies server-side to
https://accounts.svc.plus/api/auth/* accounts.svc.plusreturns either a session token or an MFA challenge
The browser should not call accounts.svc.plus directly for login.
Fast Triage
Run these checks first:
curl -si https://console.svc.plus/login | sed -n '1,20p'
curl -si https://console.svc.plus/api/auth/login | sed -n '1,20p'
curl -si https://accounts.svc.plus/healthz | sed -n '1,20p'
curl -si https://accounts.svc.plus/api/auth/login | sed -n '1,20p'
Interpretation:
console.svc.plusreturns403withcf-mitigated: challengeCloudflare is blocking the page or auth API before Vercel sees it.console.svc.plus/api/auth/loginreturns404Vercel production is not serving the expected Next route, or Cloudflare is pointing at the wrong origin/deployment behavior.accounts.svc.plus/healthzfails Back-end outage. Fix backend first.accounts.svc.plus/api/auth/loginreturns200withmfaRequiredBackend is healthy; continue on console/Vercel/Cloudflare.
Application Checks
Verify the current build still contains the auth routes:
cd /Users/shenlan/workspaces/cloud-neutral-toolkit/console.svc.plus
yarn build
cat .next/app-path-routes-manifest.json | jq 'with_entries(select(.key|test("/api/auth/")))'
Verify the login page still uses same-origin routes:
nl -ba 'src/app/(auth)/login/LoginForm.tsx' | sed -n '64,180p'
nl -ba 'src/app/api/auth/login/route.ts' | sed -n '1,180p'
nl -ba 'src/app/api/auth/mfa/verify/route.ts' | sed -n '1,180p'
Expected behavior:
LoginFormposts to/api/auth/login- login proxy accepts backend
mfaRequired/mfaTicket - MFA verify proxy calls
/api/auth/mfa/verify
Vercel Checks
In the Vercel project for console-svc-plus, verify:
- The production deployment corresponds to the intended git commit.
- Framework preset is
Next.js. - Build command is
yarn buildor the project default, not a static export command. - Output is not being overridden to static export.
- Production Functions include
app/api/auth/loginand the otherapp/api/auth/*handlers. - Required runtime env vars are present for the auth proxy path if they are managed in Vercel.
If the route exists locally but Vercel returns 404, suspect:
- wrong production deployment selected
- wrong root directory/project link
- stale alias or domain assignment
- build output mismatch between local and Vercel
Cloudflare Checks
If curl shows cf-mitigated: challenge, check Cloudflare first.
Look for:
- Managed Challenge or WAF custom rules affecting
/login - Managed Challenge or WAF custom rules affecting
/api/auth/* - Bot Fight Mode or Super Bot Fight Mode interactions
- Transform/redirect/cache rules that alter
/api/auth/* - Page Rules or Ruleset Engine policies applied only to the production hostname
Recommended policy for auth API:
- Do not cache
/api/auth/* - Do not apply JS challenge to
/api/auth/* - Keep standard security headers, but let requests reach Vercel
Backend Verification
Use the backend directly to prove whether auth is healthy:
cd /Users/shenlan/workspaces/cloud-neutral-toolkit/accounts.svc.plus
set -a; source .env; set +a
payload=$(printf '{"identifier":"admin@svc.plus","password":"%s"}' "$SUPERADMIN_PASSWORD")
curl -sS -X POST https://accounts.svc.plus/api/auth/login \
-H 'Content-Type: application/json' \
-d "$payload"
Expected for an MFA-enabled admin:
- HTTP
200 - response contains
mfaRequired - response contains
mfaTicketormfaToken
Known Failure Signatures
POST https://console.svc.plus/api/auth/login 404Likely Vercel deployment mismatch or route not published.403withcf-mitigated: challengeCloudflare blocked request before Vercel.- login returns generic failure even though backend returns MFA challenge Console auth proxy is not parsing MFA fields correctly.
- MFA code accepted by authenticator but web login still fails Console proxy may be calling the setup endpoint instead of the login MFA endpoint.
Rollback Strategy
When a release breaks auth:
- Remove or relax Cloudflare rules affecting
/loginand/api/auth/* - Re-point domain to last known-good Vercel production deployment
- Roll back
console.svc.plus - Only then consider
accounts.svc.plusrollback
Related Files
src/app/(auth)/login/LoginForm.tsxsrc/app/api/auth/login/route.tssrc/app/api/auth/mfa/status/route.tssrc/app/api/auth/mfa/verify/route.tssrc/server/serviceConfig.ts