fix: prevent crash loop when database is unreachable
Some checks failed
Gitea CI / test-build (push) Has been cancelled

Make prisma migrate deploy failure non-fatal in start-with-migrate.js.
Previously, migration failure caused process.exit() which killed the
container, triggering an infinite restart loop. Now logs a warning
and starts the Next.js server anyway (app has DB fallbacks).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-04 14:38:59 +01:00
parent 9fd530c68f
commit 42850ea17c

View File

@@ -134,7 +134,17 @@ async function main() {
// If baseline fails we continue to migrate deploy, which will surface the real issue. // If baseline fails we continue to migrate deploy, which will surface the real issue.
} }
} }
run("node", ["node_modules/prisma/build/index.js", "migrate", "deploy"]);
const migrateResult = spawnSync(
"node",
["node_modules/prisma/build/index.js", "migrate", "deploy"],
{ stdio: "inherit", env: process.env }
);
if (migrateResult.status !== 0) {
console.error(
`[startup] prisma migrate deploy failed (exit ${migrateResult.status}). Starting server anyway...`
);
}
} else { } else {
console.log("SKIP_PRISMA_MIGRATE=true -> skipping prisma migrate deploy"); console.log("SKIP_PRISMA_MIGRATE=true -> skipping prisma migrate deploy");
} }