Question

Health Checks Failing Despite Application Running (NodeJS)

Posted February 16, 2021 408 views
MongoDBNode.jsDigitalOcean App Platform

I have a rather simple NodeJS application that just listens on 1 path for a webhook and connects to a MongoDB Atlas Database. When deploying the app, even though it’s “failing” I can check the console and see that I have successfully connected to Mongo, that all of my environment variables were set correctly, and that my App is listening on default port 8080. Despite these facts, the health checks are failing and preventing me from setting up a domain and using my application.

I saw 2 similar questions, https://www.digitalocean.com/community/questions/why-am-i-getting-a-deploy-error-health-checks
and
https://www.digitalocean.com/community/questions/app-platform-deploy-error-health-checks-deploycontainerhealthchecksfailed,

but the solution to both of these problems seemed to be specifying a host to listen on (‘0.0.0.0’) which I have tried already. By default, Express will listen on all hosts but it didn’t work that way OR when I specified the host.

I have also changed the health checks from TCP to HTTP, and tried various paths. The app works as expected locally, so I’m really not sure what gives. Hopefully this is just a small oversight and I’m missing something.

Any help would be appreciated.

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

The application is now working. If anyone runs into this issue, I originally changed the health checks from TCP to HTTP (no fix), pushed a change adding the ‘0.0.0.0’ host to my app.listen in Express (no fix), changed the route in my settings on the app platform (no fix), and then changed back to TCP and the issue was resolved. I don’t really understand what fixed the issue, since the application was working the entire time anyway despite failing upwards of 10 health checks over the course of ~15 hours, so maybe there is just some odd logic with the health checks.