#First time deploying issue

29 messages · Page 1 of 1 (latest)

dapper herald
#

Hi, I created a shared monorepo using Nx. I'm attempting to simply build my frontend react web app and view it.

Within settings I set domain to the Railway provided domain. I've also entered a start command.

I notice after I deploy when I go to the exposed app link it says there's an error and if I'm listening to PORT? I think the problem is here but not exactly sure what needs to be done, if that's the sole problem.

silk oak
#

Set the env var PORT to the port that your server is listening on

#

For nextjs it's 3000 iirc

#

Side note, if you add a start target to your apps project.json you don't need to explicitly set a start command 🙂

glad topaz
#

Also make sure you are hosting from 0.0.0.0 instead of localhost or 127.0.0.1 as that can trip us up sometimes.

dapper herald
dapper herald
silk oak
#

Usually it's in the loga

#

Logs

#

What framework are you using?

dapper herald
#

I'm trying to run a react app

silk oak
#

Ah, what is your start command?

dapper herald
#

I looked through both Build and Deploy logs a few times and never seeing anything related to ports

dapper herald
silk oak
#

That's the build target, does that actually run a server?

dapper herald
#

It's only building a simple frontend for now

silk oak
#

The thing is you need to serve your app, building it won't do much apart from building it.

Is your repo open source?

dapper herald
#

Probably a bit confused but I thought it could host my app here but yes my repo is open source

silk oak
#

Could I get a link?

dapper herald
silk oak
#

Ty Ty

#

Aight this is a sticky one. So I believe your app is not server side rendered , meaning you need a web server open to send out your app.

Setting the start command to npx nx run list:serve --configuration=production will work

However that's not an ideal solution as usually Dev servers are not meant for production

#

For static sites like this I would usually use a docker container with nginx installed. Hmm maybe nixpacks supports static files? Not sure

#

I can't figure out how you would make it use the nginx provider tho

dapper herald
#

Hmm, I see just letting it all sink in but it seems with nixpacks supporting static files this might be that missing piece I would need since I'm not server side rendering

dapper herald
silk oak
#

No worries. hubert