2 months ago
My deploy builds runs for a few seconds and then crashes. I keep running into run time errors on the build causing the crash. On the builds the system keeps pulling stale leftover build fragments to build the schema.prisma file. I am not using advanced run time and it keeps pulling the old advanced run time data to try and build the file. I have tried everything to delete these old fragments but I have had zero luck. Any suggestions?
3 Replies
Status changed to Open Railway • 2 months ago
2 months ago
FYI. I did builds by rail pack and docker. Both ways built, deployed and ran then crashed. Either way I used I kept getting the same issue which was the same stale file was being used for the build ignoring the actual file. I deleted the service and had the same exact stale file blocking the build. The agent would not or could not remove the stale file on multiple attempts. I need help getting this cleared.
a month ago
Before treating this as a Railway cache problem, I would first prove which schema file Prisma is actually reading. Prisma defaults to prisma/schema.prisma relative to the working directory unless a schema path is forced, so a root-dir or build-context mismatch can look exactly like stale cache.
Quick diagnostic: add one deploy with these steps before prisma generate or migrate:
pwd
find . -name schema.prisma -print -exec sha256sum {} ;
grep -R "old model or table name" -n . || true
Then force the schema path in every Prisma command, for example:
prisma generate --schema=./prisma/schema.prisma
prisma migrate deploy --schema=./prisma/schema.prisma
If the diagnostic shows the old schema is still inside the image, the issue is build context rather than Prisma. For Docker or monorepos, make the service directory the build context, not just the Dockerfile location. The CLI path-as-root flow is the cleanest test:
railway up --service YOUR_SERVICE --path-as-root path/to/service
If the hash is correct during build but runtime still sees the old schema, inspect volume, env, and startup scripts, because a mounted directory or startup copy step may be overriding the built file after deploy. That distinction usually separates true Railway cache from wrong schema resolution.
a month ago
Small correction to the diagnostic command above: the find exec terminator should be escaped or quoted by the shell. A copy-safe version is:
find . -name schema.prisma -print -exec sha256sum {} ";"

