DEV Community

Discussion on: Causes of Heroku H10-App Crashed Error And How To Solve Them

Collapse
 
fbaralle profile image
Francisco

Hi everyone, i was running on the same problem of H10 and H20 errors. The app was working fine (package.json "start" declared correctly, no Proclife needed) on my goorm IDE container, no errors (using mongo Atlas - cloud Database), and runing on the local port 3000. But every time I tried to deploy it in heroku it was constantly giving back these annoying errors.

Then I checked some threads on stack overflow and found the solution here
stackoverflow.com/questions/186796...

My app listening on port 3000 like this.

//app.listen(3000, function () {
// console.log("Yelp Camp Server running on Port 3000")
// });

I thought it was fine but then i tried writing it in some other way i found in the answers of that thread.

app.listen(process.env.PORT || 3000, function() {
console.log('Server listening on port 3000');

});

AND THIS SOLVED MY PROBLEM. I actually couldn't find why it wasn't working correctly on heroku (because it worked fine on my local environment), but I'm so glad its running ok now.

Hope my solution can help someone.

Collapse
 
danieljimenez0255 profile image
Daniel Jimenez

Thank you so much! That helped fixed the error I was getting!

Collapse
 
gindev77 profile image
gindev77

You rock!!!!

It was my issue too!!!! :D