Quick-Tip: IBM Bluemix & Node.js - timeout

Wednesday, March 22, 2017 at 11:43 PM UTC

It's been a while since I ran into this issue but this evening I ran into it again - so I didn't remember the solution instantly. This post is basically for me to find it later Wink

When deploying a Node.js app on IBM Bluemix make sure you check your app's "server listen" part wisely. Normally a Node app will provide a web server/service running on the default port 3000 (locally). On Bluemix they will use a different port though, so you have to make sure your app is available after you deployed it.

If you ever run into this error while deploying

Timed out after 1m0s: health check never passed

then remember this post.

In this case your listen method should look like this for both environments (local and Bluemix):

//start service
app.listen(process.env.PORT || 3000, function() {
    console.log('Service is running');

The key is using the process.env variable. Running the app on your local machine will use port 3000, on Bluemix it will compute the port - which is 5000 as far as I remember.

Leave a comment right here