First Heroku deploy failed `error code=H10`

node.jsHerokuExpress

node.js Problem Overview


I deployed my app to Heroku. It's a node.js + express + socket.io app and this is the package.json file

{
  "name": "game_test",
  "author": "Ilya",
  "description": "A test app for our board game",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app"
  },
  "dependencies": {
    "express": "3.0.6",
    "jade": "*",
    "socket.io" : "*"
  },
 "engines": {
      "node": "0.8.14"
  }
}

This is the log I get:

heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=
heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=

What does it mean?

node.js Solutions


Solution 1 - node.js

Found solution for me here: https://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-of

In my case my app crashed because I was hard setting the PORT, instead of using the port that heroku dinamicaly sets, which can be accessed with process.env.PORT

app.listen(process.env.PORT || 3000, function(){
  console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);
});

Solution 2 - node.js

I just had a similar issue with my app, I got the issue after a migration of the DB, after trying many options, the one that helped me was this:

heroku restart

(Using Heroku toolbelt for mac)

Solution 3 - node.js

I had this issue, the only problem was my Procfile was like this

web : node index.js

and I changed to

web:node index.js

the only problem was spaces

Solution 4 - node.js

In my case, i found same error because there is version difference of node and npm on my local machine and defined in package.json version.

"engines": {
  "node": "0.8",
  "npm": "1.2.x"
}

when i check using

node --version : v0.10.41
npm --version : 1.4.29

when i update my package.json to

 "engines": {
  "node": "0.10.41",
  "npm": "1.4.29"
}

It works fine :)

Solution 5 - node.js

in my case adding process.env.PORT || 3000 to my http server script, resolved. My heroku log reported 'H20' error and 503 http status.

Solution 6 - node.js

In my case, my Procfile was pointing to the wrong file (bot.js which I previously used) so once I updated it, the error was gone.

Solution 7 - node.js

Also check your database connection. I forgot to change my database connection from localhost and this crashed my app once it was pushed to heroku.

Solution 8 - node.js

In my case there was no start command in the script section of package.json file. When I created the package.json file with npm init I did not create a start script command. So I went to the package.json file, under scripts I added a new entry:

 "scripts": {
    "start": "node index.js"
  },

Saved it and uploaded to Heroku and it worked

Solution 9 - node.js

upon using hapi18, I find taking out the "host" field and setting the port to:

port: process.env.PORT || 5000 did the trick.

Solution 10 - node.js

Old Thread, but I fix this issue by setting PORT constant to process.env.PORT ||

For some weird reason, it wanted to search Env first.

Solution 11 - node.js

I faced this same problem and none of the answers above helped me. What i did was run:

node --version

and in the package.json add the engines section with your node version:

{
  "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
    "node": "6.11.1"
  }
}

Solution 12 - node.js

I had a typo

const PORT = process.env.PORT||'8080';

used to be

const PORT = process.env.port||'8080';

Solution 13 - node.js

If you locally start node server by nodemon, like I did, and it locally works, try npm start. Nodemon was telling me no errors, but npm start told me a lot of them in a understandable way and then I could solve them by following another posts here. I hope it helps to someone.

Solution 14 - node.js

In my own case, i got this error because i refuse to add a Procfile to my node js app and my "main": "app.js" was initially pointing to another js file as main. so doing these chnages get it fixed for me

Solution 15 - node.js

In my case, I forgot to set database env for deployment. you can set env by this command (I'm using mLab for MongoDB server)

heroku config:set MONGO_URI='mongodb://address'

Solution 16 - node.js

For me it was Package.json it was empty from dependencies even though i thought i did install them.. so I had to reinstall them with --save option in the end and verify they were added to the package.json.. and then push it again and it worked.

Solution 17 - node.js

My port was set to config.httpPort which resolves to 80. I fixed it by doing this:

const PORT = process.env.PORT || config.httpPort;

app.listen(PORT, ...)

Thanks a lot, it wasted me a lot of hours last night.

Solution 18 - node.js

In my case I had code=H10 and status=503 because my Procfile:

web: node build/server.js

and I included /build in .gitignore

Solution 19 - node.js

My start command had env-cmd -f ./config/prod.env node index.js.

after changing to: node index.js it got fixed.

Solution 20 - node.js

I got the same issue, the problem was my Profile was like this:

web: gunicorn__init__:app

Notice with the above there was no space between gunicorn and __ init __

instead of web: gunicorn __init__:app

Solution 21 - node.js

I got the same above error as "app crashed" and H10 error and the heroku app logs is not showing much info related to the error msg reasons. Then I restarted the dynos in heroku and then it showed the error saying additional curly brace in one of the index.js files in my setup. The issue got fixed once it is removed and redeployed the app on heroku.

Solution 22 - node.js

Password contained a % broke it for me.

Solution 23 - node.js

The H10 error code could mean many different things. In my case, the first time was because I didn't know that Heroku isn't compatible with Sqlite3, the second time was because I accidentally pushed an update with Google analytics working in development as well as production.

Solution 24 - node.js

Older thread, but for me I didn't set my .env vars in the Heroku console.

Solution 25 - node.js

i was using body-Parser that throw exception

const bodyParser = require('body-Parser')    
//Bodyparser Middleware
app.use(bodyparser.json())

intead of using

    //Bodyparser Middleware
    app.use(express.json())

this resolved my issue

Solution 26 - node.js

I want to register here what was my solution for this error which was a simple file not updated to Github.

I have a full stack project, and my files are structured both root directory for backend and client for the frontend (I am using React.js). All came down to the fact that I was mistakenly pushing the client folder only to Github and all my changes which had an error (missing a comma in a object's instance in my index.js) was not updated in the backend side. Since this Heroku fetches all updates from Github Repository, I couldn't access my server and the error persisted. Then all I had to do was to commit and push to the root directory and update all the changes of the project and everything came back to work again.

Solution 27 - node.js

I struggle with the same error for hours, but I was able to solve it. I installed multer and aws-sdk as a devDependencies by mistake, instead of just dependencies. So, anyone who has the same error, just double-check your package.json file.

Also, a small tip for the property of the engine in package.json.

enter code here
//The greater or equal operators will make sure that you use the right node 
//version 
//even if your current node is greater version than npm node

"engines": {
"node": ">= 0.8.14"
},


//insted of
"engines": {
  "node": "0.8.14"
}

Solution 28 - node.js

I was deploying python Django framework when I got this error because I forget to put my app name web: gunicorn plaindjango.wsgi:application --log-file - instead of plaindjango

Solution 29 - node.js

For me, I had things unnecessarily split into separate folders. I'm running plotly dash and I had my Procfile, and Pipfile (and lock) together, but separate from the other features of my app (run.py and app.py, the actual content of the pages being used was in a subfolder). So joining much of that together repaired my H10 error

Solution 30 - node.js

// PORT
const PORT = process.env.PORT || 8081;

// Listen on port 8081
app.listen(PORT, () =>
  console.log(`Application is listening on port ${PORT}!`)
);

process.env.PORT will handle whatever port is needed on, for example, Heroku, AWS etc.

Solution 31 - node.js

In my case it was due to the heap memory limit.

  1. Just add some of the dependencies to the dev dependencies object.
  2. Remove unused modules.

You can see the exact error using heroku restart and if it is the memory limit, then upgrade your heroku account.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionilyoView Question on Stackoverflow
Solution 1 - node.jsMartin SchaerView Answer on Stackoverflow
Solution 2 - node.jsclarenswdView Answer on Stackoverflow
Solution 3 - node.jsArian NargesiView Answer on Stackoverflow
Solution 4 - node.jsMahesh Singh ChouhanView Answer on Stackoverflow
Solution 5 - node.jsEwertom MoraesView Answer on Stackoverflow
Solution 6 - node.jsSina MerajiView Answer on Stackoverflow
Solution 7 - node.jslindsaymacveanView Answer on Stackoverflow
Solution 8 - node.jsMahmoud AwadView Answer on Stackoverflow
Solution 9 - node.jslittlebotrjView Answer on Stackoverflow
Solution 10 - node.jsIsaac FrankView Answer on Stackoverflow
Solution 11 - node.jsMartin De SimoneView Answer on Stackoverflow
Solution 12 - node.jsOmarView Answer on Stackoverflow
Solution 13 - node.jsErikView Answer on Stackoverflow
Solution 14 - node.jsForest babaView Answer on Stackoverflow
Solution 15 - node.jsminjun younView Answer on Stackoverflow
Solution 16 - node.jsRomanView Answer on Stackoverflow
Solution 17 - node.jsTamal WebView Answer on Stackoverflow
Solution 18 - node.jsDonovantView Answer on Stackoverflow
Solution 19 - node.jsItay TurView Answer on Stackoverflow
Solution 20 - node.jsMoureen CarolineView Answer on Stackoverflow
Solution 21 - node.jsPraveenView Answer on Stackoverflow
Solution 22 - node.jsNash WorthView Answer on Stackoverflow
Solution 23 - node.jsTrevor HauckView Answer on Stackoverflow
Solution 24 - node.jsJosh LavelyView Answer on Stackoverflow
Solution 25 - node.jsS.SidView Answer on Stackoverflow
Solution 26 - node.jsLuis FebroView Answer on Stackoverflow
Solution 27 - node.jsTaulant VokshiView Answer on Stackoverflow
Solution 28 - node.jsTalha AnwarView Answer on Stackoverflow
Solution 29 - node.jsTclack88View Answer on Stackoverflow
Solution 30 - node.jsClancinioView Answer on Stackoverflow
Solution 31 - node.jsNagibabaView Answer on Stackoverflow