medusa: Healthcheck Fails after Default Deployment to Railway from Medusa Docs
Bug report
Describe the bug
After running a default deployment to Railway using the provided steps from the Medusa documentation, the healthcheck consistently failed. The service repeatedly returned “service unavailable” across all attempts.
System information
Medusa version (including plugins): backend template Node.js version: not sure Database: Postgres and redis Operating system: n/a Browser (if relevant):
Steps to reproduce the behavior
1. Follow the default deployment guide provided by Medusa for Railway.
2. Observe the healthcheck status after deployment.
Expected behavior
The healthcheck should succeed and the service should be available.
Screenshots
If applicable, add screenshots to help explain your problem
Code snippets
Pushing [==================================================>] 670.8MB 76f1e49ca557
Pushed 76f1e49ca557
2919c052-6a54-4066-93cb-f2dc99018ef8: digest: sha256:1242fafbc7ccd3baa728cd52af4586839547c039e1c46fb9b469660e1eae9678 size: 2842
Publish time: 34.01 seconds
Starting Healthcheck
Path: /health
Retry window: 5m0s
Attempt #1 failed with service unavailable. Continuing to retry...
... Attempt #14 failed with service unavailable. Continuing to retry for 28s
1/1 replicas never became healthy!
Healthcheck failed!
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 6
- Comments: 23 (4 by maintainers)
Incase this helps anyone else the problem I was getting an error saying health checked failed deploying to digital ocean apps.
In the medusa docs it says more time is needed between the build and health check so I set the deley health check to 300s and it seems to work. so have a look on your hosting and see if this option is there.
I assume medusa takes a little longer than standard node apps to completely spin up .
hope this helps someone
@samhenderson511 can confirm that I have the admin working via Vercel and that it’s connected to the backend so I’m able to login, create a product etc.
A few changes I made to deploying to Railway:
autoRebuild
option tofalse
build:admin
script in my package.json tomedusa-admin build --deployment
yarn run build
So my medusa-config.js plugins looks like so:
My package.json scripts:
I also have environment variables pointing towards the Railway Postgres and Redis instances as mentioned by @shahednasser above.
I then followed the instructions to deploy the admin to Vercel here: https://docs.medusajs.com/deployments/admin/deploying-on-vercel