[node.js] First Heroku deploy failed `error code=H10`

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?

This question is related to node.js heroku express

The answer is


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


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'


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


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.


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"
}

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.


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"
  }
}

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.


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.


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)


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


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


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


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

web: node build/server.js

and I included /build in .gitignore


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.


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.


I had a typo

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

used to be

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


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


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.


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


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.


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


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.


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

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


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 :)


Password contained a % broke it for me.


Examples related to node.js

Hide Signs that Meteor.js was Used Querying date field in MongoDB with Mongoose SyntaxError: Cannot use import statement outside a module Server Discovery And Monitoring engine is deprecated How to fix ReferenceError: primordials is not defined in node UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac internal/modules/cjs/loader.js:582 throw err DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean`

Examples related to heroku

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip Can't push to the heroku ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings How to enable CORS in flask Error: Cannot pull with rebase: You have unstaged changes How to solve error "Missing `secret_key_base` for 'production' environment" (Rails 4.1) Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null') 'heroku' does not appear to be a git repository Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes How do I set up DNS for an apex domain (no www) pointing to a Heroku app?

Examples related to express

UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block jwt check if token expired Avoid "current URL string parser is deprecated" warning by setting useNewUrlParser to true MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] npm notice created a lockfile as package-lock.json. You should commit this file Make Axios send cookies in its requests automatically What does body-parser do with express? SyntaxError: Unexpected token function - Async Await Nodejs Route.get() requires callback functions but got a "object Undefined" How to redirect to another page in node.js