Deployed my turborepo app but getting a 502 error
spinboxx
HOBBYOP

2 months ago

I’ve just deployed the server for my Turborepo application.

The build completes successfully, but when I try to access my domain online, I get a 502 error. I’ve seen other posts similar to mine, but I didn’t find an answer to my issue.

I created an npm run start:server command at the root of the project to start my server from the /dist directory.

Could someone help me?

The repo: https://github.com/SpinBoxx/turborepo-boilerplate

Solved

5 Replies

spinboxx
HOBBYOP

2 months ago

my deploy logs

Attachments


proudparrot2
HOBBY

2 months ago

When you get the 502s when going to your application do you see any logs from your service?

If you're talking about the big red blob of "errors" that's just to not pollute stdout with non-service-specific logs and is something that most tools will do.


spinboxx
HOBBYOP

2 months ago

I thought it was a problem with importing other files into my index.ts since I’m in a monorepo, but actually, even with an index.ts in my API where I just return a string, I still have the problem.


echohack
EMPLOYEE

2 months ago

Hey there,

Looks like you're binding to ::1 instead of 0.0.0.0.

Update that and you should be good to go.

https://docs.railway.com/guides/public-networking#railway-provided-port


Status changed to Awaiting User Response Railway 2 months ago


spinboxx
HOBBYOP

2 months ago

Hello echohack

Just updated my code as you said, and it works! You get one new user instead of the other v company :D
Thanks

fastify.listen(
	{
		port: Number(process.env.PORT) || 8080,
		host: process.env.HOST || "0.0.0.0",
	},
	() => {
		console.log(
			`Server running on port ${process.env.PORT} || 8080}`,
		);
	},
);

Status changed to Awaiting Railway Response Railway 2 months ago


Status changed to Solved spinboxx 2 months ago


Status changed to Solved spinboxx 2 months ago


Loading...