[Deploy] - Astro SSR
I'm trying to deploy a Astro SSR project, but is showing the error message "Server Error/Application failed to respond"
I tried using the following commands to
start
:
- node dist/server/entry.mjs
(current)
- astro preview
- astro preview --port $PORT
I'm not using Dockerfile or custom build, i'm just running npm build
(alias to default astro build
) and npm start
.
My astro.config.mjs
:
Solution:Jump to solution
i solved using default host
HOST=0.0.0.0 node dist/server/entry.mjs --host $HOST
...12 Replies
Project ID:
5ab20b28-3445-434a-b4a5-ec887feb9c01
5ab20b28-3445-434a-b4a5-ec887feb9c01
Could you send a screenshot or export of the logs/error?
https://bookmarklets.up.railway.app/log-downloader/
doesn't have any errors about build/deploy, but the server doesn't complete the request/endpoint
Can you define a port (8080) in your Astro configuration? Then create a variable in your service called
PORT
with a value of 8080
.
It appears it’s not given a port to listen on for the preview build, so it’ll generate its own, alike visual studio does.ok i'll try
npm run start -- --port 8080
start
script in your package is your node dist/server/entry.mjs
in your code would actually be a better more permanent approach, in addition to using npm run start
as your start command, which you can leave blank because it’s givenoh
Solution
i solved using default host
HOST=0.0.0.0 node dist/server/entry.mjs --host $HOST
since I use Railway I always use the default port provided by deploy/railway
but looks good, thanks bro! 🤝
New reply sent from Help Station thread:
i solved using default hostHOST=0.0.0.0 node dist/server/entry.mjs --host $HOSTwhich file did you place this code into?You're seeing this because this thread has been automatically linked to the Help Station thread.