R
Railway11mo ago
Alec

Railway Public Domain not working for Next.js app running via nx

Project ID: c50bf9da-0e9b-4d41-b229-8bd6503385a7 I have a Next.js app running from within a nx monorepo. It runs fine locally and the server logs look fine (see below). I've tried passing an explicit host to it of 0.0.0.0, I've tried forcing the port with a PORT env var. For some reason no matter what when I try to access the generated domain I get Application failed to respond. Any ideas what to try? Logs:
yarn run v1.22.21

$ /app/node_modules/.bin/nx run-many --target serve --projects=client --parallel --port 7623 --nx-bail=true --maxParallel=100 --configuration=production

> NX Running target serve for project client:

- client



With additional flags:

--port=7623



> nx run client:serve:production --port 7623

[ ready ] on http://localhost:7623
yarn run v1.22.21

$ /app/node_modules/.bin/nx run-many --target serve --projects=client --parallel --port 7623 --nx-bail=true --maxParallel=100 --configuration=production

> NX Running target serve for project client:

- client



With additional flags:

--port=7623



> nx run client:serve:production --port 7623

[ ready ] on http://localhost:7623
Config:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "yarn run nx run-many --target build --projects=client --parallel --configuration=production"
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn run nx run-many --target serve --projects=client --parallel --port $PORT --nx-bail=true --maxParallel=100 --configuration=production",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "yarn run nx run-many --target build --projects=client --parallel --configuration=production"
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn run nx run-many --target serve --projects=client --parallel --port $PORT --nx-bail=true --maxParallel=100 --configuration=production",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
3 Replies
Percy
Percy11mo ago
Project ID: c50bf9da-0e9b-4d41-b229-8bd6503385a7
Brody
Brody11mo ago
the logs say it's listening on localhost, but it needs to listen on 0.0.0.0 https://docs.railway.app/guides/fixing-common-errors
Alec
AlecOP11mo ago
i tried passing that and nx showed it was passing the param, I assumed that console log was just wrong, but i'm starting to thing there's a problem with using @nrwl/next:server, gonna try using nx for the build and using next start to actually run it
Want results from more Discord servers?
Add your server