From 9f10f0f4e979978f753ff42fc6440d6b0a0ce619 Mon Sep 17 00:00:00 2001 From: ngenohkevin Date: Tue, 12 May 2026 21:35:02 +0300 Subject: [PATCH] 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 --- apps/dokploy/scripts/migrate-auth-secret.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dokploy/scripts/migrate-auth-secret.ts b/apps/dokploy/scripts/migrate-auth-secret.ts index 5a71678d9..302612c6d 100644 --- a/apps/dokploy/scripts/migrate-auth-secret.ts +++ b/apps/dokploy/scripts/migrate-auth-secret.ts @@ -46,7 +46,7 @@ async function main() { if (records.length === 0) { console.log("✅ No 2FA records found, nothing to migrate."); - return; + process.exit(0); } console.log(`📦 Found ${records.length} 2FA record(s) to migrate.`);