2 years ago
Here's the repo: https://github.com/Kweebac/messagingApp/
I started a new project, created a MongoDB database and added the shared variable MONGO_PRIVATE_URL, added all my other ENV variables, changed the root directory to /server and generated a domain. The deployment worked, but when I go to the domain it says "Application failed to respond".
In the logs it says this, and keeps restarting over and over.
67 Replies
2 years ago
make sure your app is listening on the PORT provided by Railway
I recommend you check this out:
2 years ago
no problem 🙂
2 years ago
Awesome, I'm happy to help! :D
Just noticed it's still giving me this error and restarting over and over, yet on the domain it seems fine?

2 years ago
Mind sending me a screenshot of your memory metrics in your service?
2 years ago
in your service you'll see a Metrics tab

2 years ago
you can click on that to see your application's metrics, it shows info about your app's cpu, memory and network usage
2 years ago
dang your app uses next to no memory, what the flip
2 years ago
typically a good thing but I feel this may not be intended here
I'm wondering if your app may be trying to allocate more than 500mb of memory quickly after starting up, and if that fails your app exits making it show no memory usage even though it wants to use a ton of memory
2 years ago
If I'm right then yes that would be the solution, and you can do that by upgrading to hobby plan ( which increases the cap from 500mb to 8gb )
2 years ago
Although, I'm not 100% certain that this is in fact the issue
I have the frontend hosted on Vercel and it seems to be communicating with the backend correctly though lol
2 years ago
oh, maybe it's just an operation in your app that's failing to allocate the required memory instead of your entire app then 🤔
2 years ago
oh well, if it works it works 😆
2 years ago
oh 💀
2 years ago
then this is still my best guess about what's happening
Do most MERN apps need more than 500mb of memory allocated like this or have I just wrote bad code or something lol
2 years ago
wait one last idea, could you try setting a NODE_OPTIONS service variable to --max-old-space-size=8192
2 years ago
it largely depends on your app itself, like how big of a userbase it has and what specifically goes on inside of it, I use a similar stack and my apps use around 100mb to 300mb depending on the scale
2 years ago
okay definitally a step in the wrong direction then 🤣
2 years ago
I'm gonna go ahead and lock in on this then
2 years ago
Feel free to wait for a second opinion though
2 years ago
Maybe someone else has an idea
2 years ago
Sounds good, hopefully that does solve your issue
Yeah… I've been trying to host my website for 2 days now and I can confidently say it's the worst part of webdev 😭
2 years ago
lmao, fr
2 years ago
Railway's mission is to make it the easiest part of web dev 🚀
2 years ago
Darn, that's unfortunate
2 years ago
so it runs for about a minute before crashing?
2 years ago
I wouldn't recommend using nodemon in production
2 years ago
nodemon is strictly meant for development
Honestly the first 2 days I tried doing this I didn't even know the frontend and backend were meant to be deployed separately LOL
2 years ago
exactly
Seems to be working now, API calls do feel noticeably slower now that I'm not using [localhost](localhost), is this normal?
2 years ago
yea, when you're testing locally then your apps are in the same machine and so requests are practically instant as opposed to running in development where the server is usually in a server far away from the client computer
your deployment is running in US-west, so if you're far away from western US then API calls will be significantly slower
This whole experience was just depressing lol, time to go do fun things with my life again
2 years ago
lmao, enjoy!
2 years ago
of course, any time <:SmileFluent:865334941150871592>

