NoobSter NoobSter - 1 year ago 193
Node.js Question

deploying meanstack app to heroku.. error code: h10

I keep getting this error:

2016-05-22T03:01:43.469185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" request_id=8d80202e-290f-4872-88ff-9276fa1be5db fwd="" dyno= connect= service= status=503 bytes=

I looked it up in heroku, and... it indicates that my app has crashed.. (thanks heroku... ).

here's my package.json:

"name": "angular-express-part1",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "NODE_ENV=production nodemon ./bin/www",
"test": "NODE_ENV=development nodemon ./bin/www"
"dependencies": {
"async": "^2.0.0-rc.3",
"aws-sdk": "^2.3.11",
"bcryptjs": "^2.3.0",
"body-parser": "~1.0.0",
"cli-color": "^0.3.2",
"cookie-parser": "~1.0.1",
"crypto": "0.0.3",
"debug": "~0.7.4",
"express": "~4.0.0",
"express-method-override": "0.0.3",
"jwt-simple": "^0.5.0",
"moment": "^2.13.0",
"mongoose": "^4.4.14",
"morgan": "~1.0.0",
"request": "^2.72.0",
"static-favicon": "~1.0.0",
"underscore": "^1.6.0"
"engines": {
"node": "~5.10.0",
"npm" : "~3.8.0"

my DB configuration:

var mongoose = require('mongoose');

// Connections
var developmentDb = process.env.MONGODB_URI;
var productionDb = process.env.MONGODB_URI;
var usedDb;

// If we're in develoment...
if (process.env.NODE_ENV === 'development') {
// set our database to the development one
usedDb = developmentDb;
// connect to it via mongoose

// If we're in production...
if (process.env.NODE_ENV === 'production') {
// set our database to the development one
usedDb = productionDb;
// connect to it via mongoose

// get an instance of our connection to our database
var db = mongoose.connection;

// Logs that the connection has successfully been opened
db.on('error', console.error.bind(console, 'connection error:'));
// Open the connection
db.once('open', function callback () {
console.log('Databsae Connection Successfully Opened at ' + usedDb);

Not sure what's up. it's working in production...

Any clarity would be much appreciated.

Answer Source

Answering because I can't comment yet.

As the error indicates, the router has encountered a crashed process when trying to send requests to your application. In this situation it's best to run a tail of your logs (eg heroku logs --tail) and then restart your application and watch to a stacktrace. That's where you will find more information on what is causing the app to crash.

If it makes it through boot, you may need to do some acceptance testing to see what snags you can hit to crash the application and in turn throw the exception in your logs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download