Search code examples
node.jsherokuweb-deploymentweb-hostingheroku-toolbelt

Deploying nodeJS to Heroku internal error


I am trying to upload NodeJS app to Heroku. Everything installs fine and when I run

heroku local

Then everything works as expected on a local host. But when I run

heroku ps:scale web=1
heroku open

Browser opens, and it is loading the page for like 2-3 minutes, or even more and then I receive Application error. I am new to web development so that any ideas will be helpful. Thanks!


Solution

  • Thanks to gnerkus I managed to figure that out. In logs I found next error:

    heroku Error R10 (Boot timeout) -> Web process failed to bind to $PORT
    

    Heroku dynamically assigns port to app and I was doing it manually:

    app.listen(4000, function () {
    

    Instead i just need listen like this:

    .listen(process.env.PORT || 5000)
    

    Answer was here: Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)