Anyone who has recently deployed a nodejs server on railway willing to help?
My server runs fine locally, however when deployed its not listening to the requests. I put in the run command as "node dist/index.js" which works perfectly fine in the local machine. I am also listening to the recommended port "process.env.PORT" which railway provides as an environment variable and ip of '0.0.0.0' as mentioned in the docs. Not sure what am I doing wrong here.
42 Replies
Project ID:
db634f71-f603-49d6-a5b1-73020aa17159
db634f71-f603-49d6-a5b1-73020aa17159
I apologize but I only see "service id" in the settings
not the project id
show me the code that runs the server?
Which part would you like me to paste here
the code that runs the server
you mean the build script?
no
like the entire server code?
no
can you share the repo instead
not sure if its ok to ask but can I pay you for an hour of your time and add you to the repo? I am undergoing a SOC2 audit right now and its a private repo
its just 300 lines of code
put me in the repo brody192
ok gimmi sec
i think github is down just keeps spinning when adding collaborator pls give me one min
oh damn
now it seems to work
adding
added
delete the dist and ds store file from the repo, then add
dist/
and .DS_Store
to your .gitignoreI see ok one min thanks
done
let me check once
yes i think I did it
should i check deployement?
of course
Ok this is ridiculus it works! How though!!
Thanks allot
while you may have been using
process.env.PORT
in the typescript code, the built index file in dist was old and outdated, still listening on a fixed portWow, I would have never guessed
is there a way to tip you good sir?
do you also offer consulting?
thank you again
if you absolutely insist, there's a buymeacoffee in my bio, do not feel obligated to send anything, I never expect anything in return
Thank you so much, let me find that link
Done, thanks again, can I add you as a friend?
sure!
Sorry i am new to discord just figuring it out
no worries
and thanks for the trains 🙂
haha sure thing! I guess friend reqs are not allowed
they should be, but I have no clue
you're always welcome to open more help threads me or the other conductors will be around
Thank you that sounds amazing
So on ec2 I used to run these jobs using pm2, is it neccessary to do that in this case as well or would node dist/index suffice?
Just making sure the server wouldn't stop
node dist/index.js would suffice, since railway would restart your deployment if it crashed
I see that sounds really great
lot a problems can arise from using pm2 or nodemon on railway in fact
Oh I see
though I know those are two different things, you get my point lol
Yeah no I get it
any more questions?
Deploying the main project to see if it connects to wss 😄
not yet 😄
where is the websocket server hosted?
railway?
guess i didn't get the question
oh I thought the deployment on railway is connecting to a different websocket server
Oh no, i have a next js project that connects to the socket server
ah I see, we'll let me know if you have any troubles
thank you will do