fix(migrate-auth-secret): exit cleanly when there are no 2FA records

The empty-records branch of `main()` returned without calling
`process.exit(0)`, leaving the Drizzle Postgres connection pool
holding the event loop open. The `migrate-auth-secret` process
then hangs indefinitely after printing "No 2FA records found,
nothing to migrate." causing the upstream `0.29.3.sh` security
migration script (which calls this via `docker exec`) to never
reach its final `docker service update` step that mounts the new
Docker Secret. Operators end up with the new secret created but
the dokploy service still configured with the hardcoded
`BETTER_AUTH_SECRET`, while believing the migration completed.

Match the success branch a few lines below which already does
`process.exit(0)`, and the pattern used in sibling scripts
`reset-password.ts` and `reset-2fa.ts`.

Closes #4392
This commit is contained in:
ngenohkevin
2026-05-12 21:35:02 +03:00
parent b109e0ebc4
commit 9f10f0f4e9

View File

@@ -46,7 +46,7 @@ async function main() {
if (records.length === 0) { if (records.length === 0) {
console.log("✅ No 2FA records found, nothing to migrate."); console.log("✅ No 2FA records found, nothing to migrate.");
return; process.exit(0);
} }
console.log(`📦 Found ${records.length} 2FA record(s) to migrate.`); console.log(`📦 Found ${records.length} 2FA record(s) to migrate.`);