503 error after deploy

I'm trying to deploy a NodeJS application with express, apollo client and MongoDB Atlas, the build and deploy complete successfully but I can't access the API (I get 503)
14 Replies
Percy
Percy2y ago
Project ID: 837ab9b4-5e5c-440b-aadc-41a59407c4d9
Silvao
SilvaoOP2y ago
837ab9b4-5e5c-440b-aadc-41a59407c4d9
Ray
Ray2y ago
do you see any errors in your server logs? What's your PORT environment variable?
Silvao
SilvaoOP2y ago
My listen port is process.env.PORT (railway port) Didn’t give any error
Silvao
SilvaoOP2y ago
My server log
Ray
Ray2y ago
try tweaking express to listen on 0.0.0.0:
app.listen(port, `0.0.0.0`, () => { ... })
app.listen(port, `0.0.0.0`, () => { ... })
also make sure that you don't have a PORT service variable set
Brody
Brody2y ago
this is strange because express will listen on 0.0.0.0 by default unless maybe Apollo is changing the default behaviour, thanks for the help rc!
Silvao
SilvaoOP2y ago
I tried but it didn't work, any other possibilities of what it could be?
Brody
Brody2y ago
im stumped do you think you could share your repo?
Silvao
SilvaoOP2y ago
yes, sure i'll make it public
Silvao
SilvaoOP2y ago
GitHub
GitHub - sgalvao/rifa-api
Contribute to sgalvao/rifa-api development by creating an account on GitHub.
Brody
Brody2y ago
ah yes, youre committing the built dist folder to github and rimraf isn't overriding the build dist https://github.com/sgalvao/rifa-api/blob/718b2d11213d9f6439c8aae338ad751ee53aeeed/dist/src/server.js#L38 its listening on port 3000, but logging that its listening on env.PORT add dist to your .gitignore then do this stuff https://stackoverflow.com/a/19095988/13155318
Silvao
SilvaoOP2y ago
it worked, thank you very much, I was even ashamed after seeing what the problem was haha! saved my weekend bro! thanks
Brody
Brody2y ago
no problem! rc was a big help too
Want results from more Discord servers?
Add your server