Railway start script runs in a loop until it hits max retries (MedusaJS monorepo)
cytryn
HOBBYOP

4 months ago

My MedusaJS v2 app (in a Yarn 4 monorepo) enters a deployment loop on Railway where migrations and admin build complete successfully but then restart 3 times before failing. I've tried various approaches including combining all commands into a single script (medusa db:migrate && medusa build && medusa start) but Railway still appears to interpret this as a crash and retries the deployment

My build command under Nixpacks is: cd apps/backend && yarn install --immutable

And my start command is:
cd apps/backend && yarn predeploy && yarn start

with predeploy being: medusa db:migrate .

It is likely something on my end since everything fails every time but I can't figure out why.

Solved$10 Bounty

3 Replies

Railway
BOT

4 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


alandotcom
PRO

4 months ago

Move the pre-deploy out of the start command and into predeploy, https://docs.railway.com/guides/pre-deploy-command


cytryn
HOBBYOP

4 months ago

It was a Yarn 4 issue. I changed to run on npm and it's fine now.


Status changed to Solved brody 4 months ago


Loading...