fix: prevent crash loop when database is unreachable
Some checks failed
Gitea CI / test-build (push) Has been cancelled
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:
@@ -134,7 +134,17 @@ async function main() {
|
||||
// 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 {
|
||||
console.log("SKIP_PRISMA_MIGRATE=true -> skipping prisma migrate deploy");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user