Remove the redundant, always-failing npm run prisma:migrate step in start.js #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On every boot the daemon logs a full
ENOENTerror +Error: Command failed: npm run prisma:migratestack trace, then continues. It's harmless today but it's pure noise, it masks real startup errors, and the catch-and-continue is a latent footgun.Symptom (cfaun / ariege-io, nsecbunkerd 0.10.5, every boot)
…then the daemon proceeds normally (
✅ nsecBunker ready to serve requests.).Cause
scripts/start.js:22doesexecSync('npm run prisma:migrate'). In the nix-packaged runtime there is nonpm/shon the servicePATH, so the spawnENOENTs beforeprisma migrate deployever runs. The surrounding code swallows the failure and continues.Why it's currently harmless (verified)
Migrations are actually applied at deploy time, not by the daemon. On cfaun,
_prisma_migrationscontains all 24 migrations including the latest:So the in-daemon
migrateis redundant — the deploy'smigrate deployalready did the work. (This was confirmed while deploying #27: schema correct, data intact, migration recorded — the only thing wrong was this scary log line.)Why it's still worth fixing
status: 254+ stack trace on every boot trains operators to ignore startup errors, and buried a real investigation during the #27 rollout (we initially mis-read it as "migration didn't apply").Proposed fix (pick one)
execSync('npm run prisma:migrate')step fromstart.jsand rely on deploy-timemigrate deploy(current reality on the nix hosts).npm), so it works in-process.Cross-refs
⚠️ Caveat before anyone implements this as a straight removal:
start.js's migrate step is load-bearing on docker, only dead on nix.DockerfilesetsENTRYPOINT ["node", "./scripts/start.js"]with the explicit comment "Run via scripts/start.js soprisma migrate deployapplies pending migrations", anddocker-compose.ymlalso wires a dedicatedmigratecommand. devDeps (incl. the prisma CLI) are kept in the image, sonpm run prisma:migrateworks there — it's the migration path.prisma migrate deployitself, andstart.js'sexecSync('npm run prisma:migrate')fails in the read-only nix store (nonpmon PATH) → caught + logged. Redundant + noisy there, hence the "always-failing" framing — but that's nix-specific.So a blanket removal breaks docker migrations. Options:
node_modules/.bin/prisma migrate deployinstead ofnpm run), so it works on nix too and stops being a no-op rather than being deleted.Leaning (1) — it's the smallest change that makes the step correct everywhere instead of dead-on-one-platform. Flagging so this doesn't ship as a removal that silently breaks the docker path.