Next.js - Application failed to respond after deployed

kimskogsmoPRO

a year ago

Hi,

I am trying to deploy a Medusa ecommerce project. I deployed the backend and redis + postgres successfully. When it comes to the medusa storefront, I'm a bit stumped. It feels like I am missing something basic.

It builds and deploys, but when I try to access my app at stickers.mydomain.com (I connected a custom domain) it just says "Application failed to respond".

I set an environment variable in railway "PORT" to 8000.I have a start script like so:

"start": "next start -h 0.0.0.0 -p 8000"

Railway suggests running my app on 0.0.0.0 which to me it seems like it's doing, but no logs are showing up when I try to access my app with its public url.

What am I missing here?

My project ID: 5a30595b-5dda-4a36-b4c7-20bca6a20159My service ID: 6ef34b0c-8133-4ef4-a2af-ed1f35fbb1ed

Solved

3 Replies

a year ago

Generally you'd want to use $PORT instead of setting a fixed port in your start command and then if your app does need to listen on a fixed port you would set that port in your service variables incase you need to reference it, so please try that instead.


Status changed to Solved railway[bot] 11 months ago


kimskogsmoPRO

a year ago

Generally you'd want to use $PORT instead of setting a fixed port in your start command and then if your app does need to listen on a fixed port you would set that port in your service variables incase you need to reference it, so please try that instead.

Thank you! That was indeed it! The port variable injected by Railway needed to be specified in my start script.

next start --port ${PORT-3000}

a year ago

Happy to help!


Next.js - Application failed to respond after deployed - Railway Help Station