R
Railway7mo ago
luci1

[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:
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import react from "@astrojs/react";

import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind({
applyBaseStyles: false
}), react()],
prefetch: true,
output: "server",
experimental: {
actions: true
},
// redirects: { "/dashboard": "/dashboard/stores" },
vite: {
ssr: {
noExternal: ["@radix-ui/react-select"]
}
},
adapter: node({
mode: "standalone"
})
});
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import react from "@astrojs/react";

import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind({
applyBaseStyles: false
}), react()],
prefetch: true,
output: "server",
experimental: {
actions: true
},
// redirects: { "/dashboard": "/dashboard/stores" },
vite: {
ssr: {
noExternal: ["@radix-ui/react-select"]
}
},
adapter: node({
mode: "standalone"
})
});
Solution:
i solved using default host HOST=0.0.0.0 node dist/server/entry.mjs --host $HOST...
Jump to solution
12 Replies
Percy
Percy7mo ago
Project ID: 5ab20b28-3445-434a-b4a5-ec887feb9c01
luci1
luci1OP7mo ago
5ab20b28-3445-434a-b4a5-ec887feb9c01
Jack
Jack7mo ago
Could you send a screenshot or export of the logs/error? https://bookmarklets.up.railway.app/log-downloader/
luci1
luci1OP7mo ago
doesn't have any errors about build/deploy, but the server doesn't complete the request/endpoint
No description
Jack
Jack7mo ago
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.
luci1
luci1OP7mo ago
ok i'll try
Jack
Jack7mo ago
Or create that variable and set your start command to npm run start -- --port 8080 Make sure your start script in your package is your node dist/server/entry.mjs
http.ListenAndServe(":8080", nil)
http.ListenAndServe(":8080", nil)
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 given
luci1
luci1OP7mo ago
oh
Solution
luci1
luci17mo ago
i solved using default host HOST=0.0.0.0 node dist/server/entry.mjs --host $HOST
luci1
luci1OP7mo ago
since I use Railway I always use the default port provided by deploy/railway
luci1
luci1OP7mo ago
but looks good, thanks bro! 🤝
No description
Duchess
Duchess6mo ago
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.
Want results from more Discord servers?
Add your server