After a few days, sometimes my previously running application will flake out with this error and no longer load. I have searched, but have not found the cause. I have a hunch that it may be because I'm giving my Node.js app only 256MB memory, but cannot confirm. Any recommendations?
42 Answers
I was facing same issue, that was related to PORT using, I had given Hardcoded value in PORT that was an issue, then I used AppEnv of cfenv module and used AppEnv().port.
This solved my issue.
A 502 error can mean a variety of things, but without any logs, it is difficult to say for sure.
I agree that there is a good chance that your app is potentially running out of memory given the symptoms (or there could be a code bug which is causing some kind of unresponsive behavior).
There could be internal Cloud Foundry GoRouter / networking problems, but to debug those, you would probably need to CF SSH into a running container and trace packets. When you push the app again, you will most-likely get deployed to different machines, so many times network issues will resolve when that happens. (Given the seemingly consistent behavior of your error, I think this is unlikely.)
1