Heroku "Process exited with status 137" node.js app

I was getting the same error upon hosting a Node app on heroku turn out it was the port problem so just do this set the port equal to this

var port = process.env.PORT || 8080;

So process.env.PORT || 8080 means: whatever is in the environment variable PORT, or 8080 if there's nothing there.

And then set the set port variable in the following

var server=app.listen(port,function() {
console.log("app running on port 8080"); });

I checked the logs, it said that at=error code=H10 desc="App crashed", it means you have uncaught Exception, so you should check your code.

if you want to use mongodb on Heroku, you should try to add the mongodb addon for your application. you can find the doc here

and try to use process.env.PORT, not the port you want to use.

if it doesn't still solve your problem, you can try to use this command heroku run bash, this command can make you into heroku environment and start your server.