Programming is bittersweet.
It is very tedious and many a time, it can leave developers very frustrated with little zeal for another keypress.
However, developers are always having a whale of a time while coding, and they are full of pride and joy, once all their codes run successfully without errors.
That being said no one wants to be frustrated while coding hence no one wants bugs in their codes.

Developers, often do not get it all right ("code-wise") at first try; consequently, the software development cycle involves debugging, refactoring, upgrading, and many other enhancement operations.
In addition, developers know that many a time we all have to deal with bugs in our code. Hence debugging is an invaluable skill in a developer's repertoire. And to be successful at debugging, we need a good understanding of error messages.
Error codes or messages are the ways computers inform us that there are bugs in our codes, and sometimes it tells us where they are.
The paradox is that error codes; although are very helpful, they are not plain English and can be very confusing and cryptic
Below are error codes from a crashed app on Heroku.
2019-10-11T11:27:28.019054+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=realtylabapp.herokuapp.com request_id=74165d9f-db2a-46bd-ab9c-1a01403bd00f fwd="129.205.113.108" dyno= connect= service= status=503 bytes= protocol=https
2019-10-11T11:27:29.919409+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=realtylabapp.herokuapp.com request_id=fa48efa2-4ddf-41e6-a633-a62cb02314bd fwd="129.205.113.108" dyno= connect= service= status=503 bytes= protocol=https
Heroku uses a unique alphanumeric error code combo to communicate to the developer the kind of error that was found in their code.
This alphanumeric error code ranges from:
-
H10toH99 -
R10toR99 -
L10toL15
Get a detailed list here: Complete Heroku Error Codes
This article is focused on the Heroku H10-App crashed error code which is thrown when an application crashes on Heroku. This is as much as it goes. It does not help us with the reason our app crashed and that's where this article comes in. Below are some causes of this error and I guarantee you that some of them would surprise you greatly!
Bug in Procfile
A very interesting discovery for me. A bug in your Procfile can crash your app. If your Procfile is pointing to the wrong server file. e.g If your server is in server.js and your Procfile points to app.js this would definitely crash your app and Heroku would greet you with the H10-App crashed error code message.
Secondly, a buggy Procfile can also come in the form of wrong spacing. e.g
Wrong: web : node index.js
Correct web: node index.jsSetting a PORT as a Heroku environment variable
This would surely crash your app. Heroku automatically sets a Port that can be accessed viaprocess.env.PORT. Setting a port yourself would crash your app. Surprisingly, the commandheroku configdoes not display the preset Heroku port so one might be tempted to set another port as an environment variable.
To see all the preset Heroku environment variables, use the commandheroku run printenv.Missing Required Environment Variable while setting a port would cause this error because Heroku already sets a port internally, failing to set any required environment variable (e.g your database), would prompt Heroku to greet you with this error.
Missing Required Scripts
This error is thrown in a Node.js environment if you forget to set astart script. Heroku uses this script to start your app so if it is missing, it would throw anH10-App crashederror code message.
This can be solved by setting a start script in the package.json. e.g
"scripts": {
"start": "node index.js"
}
Final Thoughts
If none of the above solved your problem, you can make a last-ditch attempt by updating all your packages. If this doesn't help and you are in a Node.js environment, your last resort would be setting a node version in the engine section of your package.json file.
{
"name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "12.11.1"
}
}
The Unthinkable
Lastly, if your bug defiles all solution, and by this time you are grasping at straws; I leave you in the able hands of heroku restart.
Let me know if you have experienced any other cause of this error in the comment below.
Oldest comments (130)
Programming is bittersweet indeed!!!
Thanks for publishing this article... I wanted to get my hands dirty by building a graphql server and deploy it online. After the headaches writing resolvers, I finally had a final working version ready for deployment. My search led me to Heroku and I deployed in minutes. With only one command away I typed
heroku openwaiting for the magic to happen only to see "Heroku H10-App Crashed Error".Never-giving-up, I came this far and nothing will stop me. I came across you article and I figured Number 2 was my cause...
See me doing some energetic dance moves here :-)
thanks so much.... very grateful
Glad to hear you resolved your isssue.
I'm having problems with my heroku app and I have tried to update both node and the Heroku app and I have added the engines line so all that is left is the Procfile but there is no Procfile anywhere on my computer, does this mean that I have to create one and what should it look like?
Hello, Christian, I am very sorry for the late reply but I do hope if this doesn't come in at the nick of time the knowledge would be useful for your other projects.
The Procfile is always a simple text file that is named Procfile without a file extension.
This means that; Procfile.txt is not valid. And don't forget that capitalized "P". As for the content below is a configuration from one of my Procfile.
web:node --optimize_for_size --max_old_space_size=460 --gc_interval=100 server.js
cheers.
It happened again and this time, Number 2 wasn't the cause as I have already resolved that. I tried to run it locally and found out that, I made a typo in my code and it was crashing my app.
so I think you should add that to the checklist.
Glad to add this to the list parables
Hello Parables could you be more specific about what the typo was? I am very happy to update my list.
Thanks.
hi i am getting below error ,eventhough i verified everything.
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sleepy-basin-67900.herokuapp.com request_id=f0e633ca-b51e-4b81-9d2f-11857b8d4e42 fwd="157.50.221.204" dyno= connect= service= status=503 bytes= protocol=https
I have had the same problem. So, I coudn't find the solution yet.
I found the solution add another buildpack with this:
heroku buildpacks:set mars/create-react-app
without it, my app doens't worked?
Hi Robson,
Not sure what this command is but it worked for me, can see the app on screen at last (still errors) but on screen. Thanx!
Thanks a lot Robson for sharing this. Just worked for me after hours of near frustration
Just rerun build again .. this will solve the problem
This was really helpful Thanks
This was really helpful, thank you very much.
Thanks. I am glad you find it helpful.
Up until recently I was able to deploy development build to Heroku and since couple of days ago even out-of-the-box npx create-react-app would fail with H10 code - solution was to ofc deploy the production build like below:
npm install serve --s
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
}
Same happened to me. Do you know why this is happening?
We can only speculate, React was updated on March 20th and around then it stopped working so I am guessing there is something that is happening with webpack or whatever was successfully serving our apps.
The same occurred with me. Thanks for this solution.
I am glad this helped you resolve your issue.
Thanks dude.
Hero!!! Thank you!
Thank you!!! This solved it
Thank you sooo much! This sure saved me a lot of frustration. Was wondering if you could give a bit of insight about how you figured out this solution
If you look at the logs it says 'starting development server' - given that if we deploy something to heroku we want it to be prod environment for variety of reasons (stackoverflow.com/questions/481511...). I looked at the versions of react and it so happened that react itself was upped a version 2-3 days prior to my attempt to deploy so I realized that whatever heroku was doing before to serve the build server obv somehow broke so I decided to change it to prod build (which I should have done from the get go but never cared as I just wanted to send the app to friends)
Looks like i picked a bad time to attempt to deploy my first web app. Does this mean I need to run this line in my command module "npm install serve --s"
and then copy this into my package.json exactly as is?
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
}
I tried to do that and it didn't work when I went to update the master on heroku.
Thanks in advance...
As of May 23rd, 2020. This fix worked beautifully. I've never had any issues pushing to heroku until my most recent project. This was perhaps my 4th or 5th attempt to fix it and this work amazingly. Thanks DaleLuce
Works like a charm
Thanks for this it was helpful
Thank you!. This worked!
yes!!! Thank you so much!! yes yes yes yes
@daleluce Thank you so much thank uuuu!! i spent all the day to fix this problem i tied so many solution on internet but only your solution worked!! i was give up but you saved me, i made the account now to thank you <3
Thanks for letting me know Mohamed! This made my day!
Worked like a charm after 2 days of frustration! Thank you!!!
I made this app without authentication and there was no problem deploying it on heroku but now I have added authentication to it and heroku is creating trouble. Looks like I am gonna stuck here for weeks.
Yessss!!! It works to me.
Your are an angel!
Saved my week.
Thanks in advance...
I spent many hours troubleshooting and this ended up working. Thank you!!
Finally! it worked!! Thank you so much!!!!
Thanks. You saved me a lot of time and trouble.
Thanks my brother....
Greetings from Argentina Corrientes
Really thank you Very Much you saved my Wasted Time with installing serve and calling it on start script
I have no idea why, but install serve --s solved the issue!!! Why is that??
I have many other older react apps running normally on heroku without needing to install serve --s
Thanks a lot!
Thanks. It solved my problem on Heroku, but I can't run my app locally.
After installing serve and modifying package.json, when I run npm start - serve says the app is available on port 5000 but I'm getting 404 page there. (it doesn't work also on port 3000 which was the one that I used so far).
Any ideas why?
Hi Haim,
If you run yarn start/npm start now it points to 'serve -s build' instead of 'react-scripts start'.
Make sure you've added below:
"dev": "react-scripts start",
"start": "serve -s build",
and to run your app locally do npm run dev not npm start
Thanks. It didn't work with "npm dev" (I got that "dev" is invalid command), but it did work with "npm run dev".
I am glad to hear this worked for you.
Just a side note:
commands like
npm startcan work directly because they are default commands from npm but custom commands likedevset by the user would only work with theruncommand.npm run dev. I hope this clears things up.Thank you very much. Now it serves like a charm.
Wow.. this worked like a charm.
This worked!!
This was a lifesaver. Thanks!
24-Aug-2020 : I tried this fix and this worked for me ,
1.) "npm install serve --s" in my terminal
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
}
2.) copied the above code("scripts") in place of my previous code "scripts" in my package.json file
3.) git commit -am "new update"
4.) git push heroku master
and Boom I found my wesite on herokuapp
thank you very much
This worked like magic! Thank you so much!
Thank you.This worked for me
Pros BR's de plantão, isso aqui ainda funciona, fiz aqui no meu e meu deploy deu certo, caso esteja assim no seu,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
use o npm install serve --s e altere igual ao comentário a cima.
THAT STILL WORKS ON 30/01/2020
It works for me thank you very much !!!
Thank you for providing this steps, It also worked for me
Thanks a lot, now deploy on Heroku is working! But I've found another issue. Changing from npm start to serve -s build the local solution (npm run dev) is the correct one but the one on Heroku is not the same (is something like the first beninning project template). Why this difference? I've tried with a npm run build command but no difference. Thank you
Thank you soooo much!!!! this worked!!! ater 2 days of being stucked!!!!
This worked ...Thanks for saving a day's work
THANK YOU!!! i created this account just to thank you because I had so so much trouble deploying. Build was fine but after build when heroku tried to run start, I ran into so many H10 and H12 errors and the app can't even display a static page.
Your solution worked PERFECTLY!
Thank You !!!
It worked for me, thanks a lot !
Thanks Dude.... you are an angel!!
Saved my week!!
Thanks in advance...
Regarding Procfile, web: node index.js should be ok as you can see in the official documentation devcenter.heroku.com/articles/gett...
Btw, good advice is to test your app locally before deploying because errors are much more readable, so run heroku local web to check out if everything is ok then deploy.
Thanks for this pro tip.
I've struggled for hours, but finally have figured out, that I run my app from dist/server.j, but dist folder was ignored in .gitignore file, thus has been never pushed to Heroku. You can check your published files by running heroku run bash -a [APP_NAME]