DEV Community

Cover image for Causes of Heroku H10-App Crashed Error And How To Solve Them

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

Lawrence Eagles on October 12, 2019

Programming is bittersweet. It is very tedious and many a time, it can leave developers very frustrated with little zeal for another keypress. Ho...
Collapse
 
urosran profile image
Uros Randelovic • Edited

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

Collapse
 
daleluce profile image
DaleLuce

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...

Collapse
 
cmarshman profile image
Cory Marshman

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

Thread Thread
 
efecollins profile image
Efosa Collins EVBOWE

Works like a charm

Collapse
 
hickeymonster profile image
Emmanuel Okwuzi

Thanks for this it was helpful

Collapse
 
maskoul profile image
Mohamed Maskoul

@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

Thread Thread
 
daleluce profile image
DaleLuce

Thanks for letting me know Mohamed! This made my day!

Collapse
 
hickeymonster profile image
Emmanuel Okwuzi

Thank you!. This worked!

Collapse
 
danielfruitspec profile image
DanielFruitSpec

yes!!! Thank you so much!! yes yes yes yes

Collapse
 
hadarose profile image
Hadar Rosenman

Worked like a charm after 2 days of frustration! Thank you!!!

Thread Thread
 
jaytailor10 profile image
jaytailor10

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.

Collapse
 
chandanxp profile image
Chandan

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

Collapse
 
guilhermebodart profile image
Guilherme-Bodart

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

Collapse
 
tjombell profile image
Tjomb Bell

It works for me thank you very much !!!

Collapse
 
moazamdev profile image
Moazam Ali

Thank you for providing this steps, It also worked for me

Collapse
 
ajgcph2019 profile image
ajgcph2019

Thank you.This worked for me

Collapse
 
saimaar profile image
Saima Rahman

This worked like magic! Thank you so much!

Collapse
 
dalisc profile image
Dalis Chan

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!

Collapse
 
haimbuchbut profile image
Haim Buchbut

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?

Collapse
 
urosran profile image
Uros Randelovic • Edited

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

Thread Thread
 
haimbuchbut profile image
Haim Buchbut

Thanks. It didn't work with "npm dev" (I got that "dev" is invalid command), but it did work with "npm run dev".

Thread Thread
 
lawrence_eagles profile image
Lawrence Eagles • Edited

I am glad to hear this worked for you.
Just a side note:
commands like npm start can work directly because they are default commands from npm but custom commands like dev set by the user would only work with the run command. npm run dev. I hope this clears things up.

Collapse
 
marcosaponaro profile image
marcosaponaro • Edited

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

Collapse
 
radkin profile image
Noel Miller

Thanks. You saved me a lot of time and trouble.

Collapse
 
coltonkaiser profile image
Colton Kaiser

This worked!!

Collapse
 
uzairjan profile image
Uzair Khan

Thanks dude.

Collapse
 
starkky07 profile image
Kishan Sahu

Thank you very much. Now it serves like a charm.

Collapse
 
jdrichardstech profile image
JD Richards

This was a lifesaver. Thanks!

Collapse
 
hickeymonster profile image
Emmanuel Okwuzi

Thanks a lot!

Collapse
 
danielfruitspec profile image
DanielFruitSpec

Finally! it worked!! Thank you so much!!!!

Collapse
 
ezzaffa88 profile image
SOFIEN

Really thank you Very Much you saved my Wasted Time with installing serve and calling it on start script

Collapse
 
joejcox profile image
Joe Cox

Hero!!! Thank you!

Collapse
 
rohit_rambade profile image
Rohit Rambade

Thank You !!!

Collapse
 
sayanta2702 profile image
Sayanta Bhattacharje

This worked ...Thanks for saving a day's work

Collapse
 
raqgoth profile image
Raquel Gothardt

Thank you soooo much!!!! this worked!!! ater 2 days of being stucked!!!!

Collapse
 
davidgoodson profile image
Buyinza David

Wow.. this worked like a charm.

Collapse
 
lucianonahuel4528 profile image
Lucianonahuel4528

Thanks my brother....
Greetings from Argentina Corrientes

Collapse
 
marlonx19 profile image
Marlon Englemam

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

Collapse
 
ch1zo profile image
chizo nwazuo

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

Collapse
 
urosran profile image
Uros Randelovic

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)

Collapse
 
nelsong1997 profile image
Gabe N

I spent many hours troubleshooting and this ended up working. Thank you!!

Collapse
 
moidhasanbeig profile image
Moid Hasan Beig

The same occurred with me. Thanks for this solution.

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

I am glad this helped you resolve your issue.

Collapse
 
sagarkharabe profile image
Sagar Kharabe

Same happened to me. Do you know why this is happening?

Collapse
 
urosran profile image
Uros Randelovic

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.

Collapse
 
marlieer profile image
marlieer

Thank you!!! This solved it

Collapse
 
monatyagi profile image
MonaTyagi

It worked for me, thanks a lot !

Collapse
 
parables profile image
Parables

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 open waiting 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

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Glad to hear you resolved your isssue.

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
 
gindev77 profile image
gindev77

You rock!!!!

It was my issue too!!!! :D

Collapse
 
danieljimenez0255 profile image
Daniel Jimenez

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

Collapse
 
irudra profile image
Hemant Gaur

I got the same H10 app crashed but none of the above solutions worked for me. I have updated build back using this command it worked after that.

heroku buildpacks:set mars/create-react-app

Collapse
 
parables profile image
Parables

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.

  1. Check your codes and debug it for any errors.
Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Glad to add this to the list parables

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Hello Parables could you be more specific about what the typo was? I am very happy to update my list.
Thanks.

Collapse
 
tanaysukhdeve profile image
tanaysukhdeve

Thankyou so much man .I was searching for the solution for past 3 days.I m new to this and was stuck .My Procfile had an indentation problem and this quickly solved my prblem.
PS: Created an account here just to thank you.

Collapse
 
harishkgarg profile image
Harish Garg

Ran into same error message. app was deploying successfully but not opening.
Issue was I had .env as a soft link to a file outside the working folder (Ubuntu)
restored the actual file and it started working.
Somehow, if a file is needed by Heroku and it's a soft link and not the actual file, it breaks the app.
Something to keep an eye on in future.

Collapse
 
parables profile image
Parables

Okay, am back again on how to check your app for errors. In my previous case, it was a wrong import or a typo(better use Typescript to avoid these small typos) that was causing my app to crash locally.Fixing that solved it for both localhost and Heroku. But I was here again today because of the H10 error. It seems your article has now become my checklist whenever a deploying to Heroku. so to add a few tips:

  1. Run your code locally using npm and also with heroku local -a <heroku-app-name> . Make sure you test everything to make sure nothing crashes
  2. If you use .env vars, make sure to set them up in the Heroku config vars and beware of unwanted spacing in your config values. (In one case, my MongoDB Atlas con string had some unwanted spaces in my config value)
  3. Depending on your sever(esp. for Hapi), you must set your host to this:

host: process.env.HOST || '0.0.0.0' || 'localhost'

  1. Don't give up, check community support for the framework, library etc you are using, you are no the only one who has been stuck on that annoying bug. A problem shared is half solved.

That was why I was here today: I switched from Express to Hapi (just curiosity sake) only to meet this H10 error again. After lot of hours and multiple tabs of StackOverflow answers, I went to the Slack community of Hapi to seek help. It was then that I found out I needed step 3 above so make community support your last option before you even think of giving up

Collapse
 
bogicevic7 profile image
Dragoljub Bogićević • Edited

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.

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Thanks for this pro tip.

Collapse
 
kaitlynlynette profile image
Kaitlyn Rodriguez

Woooo! It's June 08, 2021 and this article keeps on giving. It worked for me! Thank so much.

Followed this exactly,

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

(start with npm run dev to run it locally )

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

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Thanks Kaitlyn Rodriguez.

Collapse
 
codealicious profile image
Codealicious • Edited

"
e.g
Wrong: web : node index.js
Correct web:node index.js

"
actually....

correct: web: node yourEntryFile.js

I was diagnosing an h10 error when I stumbled upon this post. Lots of great information, but a small error in the post sent me on a wild goose chase! In the above excerpt the wrong and correct syntax are actually reversed. the correct syntax in your Procfile should be web: node server.js server.js is just what I named my entry point and is not mandatory. What is, however, is the space between the colon and node.

I have found out that my original problem was incorrect imports between my components leading to the original h10 error. When I tried to fix it I changed my Procfile to the "correct" way mention in this post. Then later also fixed my imports. With the error still persisting I used Uros Randelovic's solution. Surprise, it worked! However, this solution was only masking the fact that in an attempt to fixed the h10 due to other issues, I changed my Procfile incorrectly to not include a space, then Uros Randelovic's solution circumvented the fact that Heroku didn't know how to start my file with a misconfigured Procfile and used the older syntax in the package.json file to correctly launch the app.

In summary if your Profile, captial P also import has web: node server.js ...or whatever filename you want to name your entry point, and a package.json file that looks like this for you scripts section...

"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}

Heroku automagically looks for "build" now. Make sure you heroku config:set your env vars from CLI
eg. heroku config:set KEY=VALUE examples of KEY=VALUE pairs would be your database config, secret key for auth, etc.. and finally properly configure the JS in your entry point. In this example my entry is server.js with the following important code

const express = require("express");
const path = require("path");
const favicon = require("serve-favicon");
const logger = require("morgan");
require("dotenv").config();
require("./config/database");

const app = express();

app.use(logger("dev"));
app.use(express.json());
app.use(favicon(path.join(dirname, "build", "favicon.ico")));
app.use(express.static(path.join(
dirname, "build")));
app.use("/api/users", require("./routes/api/users"));

app.get("/*", function (req, res) {
res.sendFile(path.join(__dirname, "build", "index.html"));
});

const port = process.env.PORT || 3001;

app.listen(port, function () {
console.log(express app running on port ${port});
});

make sure you require and install important modules, config your env and database, properly assign your port variable for either production or development and configure your server to return your index.html from the build folder when given any path.

Collapse
 
keerthilingu profile image
Keerthilingu

I was getting same error for a react app templated by create-react-app.

I resolved it by changing buildpack to github.com/mars/create-react-app-b... .
Above build pack is required for create-react-app template (static sites).

In Heroku dashboard, under settings> buildpack - I changed from node build pack to github.com/mars/create-react-app-b... and then react static web page started working (buildpack can be set via Heroku CLI also).

If your app is involving, node backend , then checkout github.com/mars/heroku-cra-node .

Collapse
 
efecollins profile image
Efosa Collins EVBOWE

I just solved this problem in my app and I consider it a big win

  1. My Procfile was fine. It had no problems 👍
  2. I had a working heroku port using process.env.PORT 👍
  3. I was missing environment variable and I had to set it by Googling 😘
  4. I was also missing required scripts which I did set using your example 😁
  5. I had to restart my dynos using heroku restart multiple times and it turned out great.

This is my second time using heroku but my first time connecting it to a database.

I made a to-do list and it's URL is @ todo-list-234.herokuapp.com/

THANKS FOR YOUR HELP!

Collapse
 
abdulkhader profile image
AbdulKhader

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

Collapse
 
robson_dejesus profile image
Robson de Jesus

I found the solution add another buildpack with this:
heroku buildpacks:set mars/create-react-app

without it, my app doens't worked?

Collapse
 
c00ki35 profile image
Cooki3

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!

Collapse
 
nwa_eneh profile image
Tony

Thanks a lot Robson for sharing this. Just worked for me after hours of near frustration

Collapse
 
robson_dejesus profile image
Robson de Jesus

I have had the same problem. So, I coudn't find the solution yet.

Collapse
 
marinar profile image
Maryna Romaniuk

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]

Collapse
 
militusinnocent profile image
Militus • Edited

I have tried everything I could but my node app wouldn't work on Heroku even though it works perfectly locally.

I attached the image of my www file for somebody who has any idea(s) to help me look at it if it is wrong or right.

PS: This is what I use locally and it is working perfectly.

Collapse
 
militusinnocent profile image
Militus

I added an image but it is not displaying.

Collapse
 
developerbryan profile image
developerbryan

Thank you, updateing the scripts resolved it for me!

Collapse
 
bernardfinbarrs profile image
Bernard

2020-04-05T10:21:57.147854+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-falls-48795.herokuapp.com request_id=c29b11d5-31c1-4514-9aec-15a792a9e481 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:22:02.304817+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-falls-48795.herokuapp.com request_id=c7100355-3ae2-40ef-a328-46526390af03 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:00.377844+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-falls-48795.herokuapp.com request_id=27532abb-087f-4262-bb6d-5a22d511f0ee fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:01.003156+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-falls-48795.herokuapp.com request_id=bd1d2d51-3531-4f18-a345-c600410a1f93 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:03.924761+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-falls-48795.herokuapp.com request_id=8ddfe113-d6ab-4e80-a875-f632ab4b0a67 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:05.323501+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-falls-48795.herokuapp.com request_id=a3dd077d-28cc-42be-b86e-52c4aa69bdf9 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:44.133118+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-falls-48795.herokuapp.com request_id=313e668d-4e4d-4069-a2e0-c25f06ba6f20 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:24:44.706001+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-falls-48795.herokuapp.com request_id=ef9591ce-8358-4c7e-8f74-4629b64ddeba fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:35:22.282511+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-falls-48795.herokuapp.com request_id=b9c0338d-00e7-4291-acba-327ab78811f8 fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https
2020-04-05T10:35:22.981007+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-falls-48795.herokuapp.com request_id=ec4c732c-9e32-4e8c-9fb1-04b70c07bffc fwd="154.118.6.176" dyno= connect= service= status=503 bytes= protocol=https

Collapse
 
vikraantnegi profile image
vikraantnegi

Same error man! Did you get a way to solve it?

Collapse
 
devanica profile image
devanica

Hello, first of all thanks for sharing. I am new with backend development and I decided to start with Go. I deployed an API to Heroku but can't seem to figure out how to connect my app to it, and so far I am receiving the error you are mentioning. Can I contact you regarding some issues?

Collapse
 
tamirazrab profile image
Tamir

I had nestjs and angular monorepo, and I was getting this error all of sudden after I created some new routes, before I wasn't building locally heruko, auto-built and deployed, and had my /dist in .gitignore, so I first built my app locally pushed dist folder to github, and after that app started working.

I don't really know why is that cause before hand last time I did tested it by creating some routes and it was all well. However try to see if it fixes for you.

Collapse
 
tocvfan profile image
Christian Hammervig

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?

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

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.

Collapse
 
dejanmarkovic profile image
Dejan Markovic

Hi ,
We are having an issue initializing the app which was created on Heroku (and worked perfectly for months). We did not touch or deploy any files (we were only adding the content).

Sometimes we get this error in the heroku logs

2021-05-09T11:26:39.184283+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sws-wiki.herokuapp.com request_id=4a1aba64-a4c0-4a1e-8bb4-231d3cc51bbb fwd="95.180.36.112" dyno= connect= service= status=503 bytes= protocol=https
2021-05-09T11:26:39.985839+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sws-wiki.herokuapp.com request_id=44a1adc6-1f14-4434-b8f7-514216845fdd fwd="95.180.36.112" dyno= connect= service= status=503 bytes= protocol=https
and sometimes this one.

Error: Cannot find module '/wiki/logs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
We have tried:

heroku restart
2021-05-09T11:39:03.848687+00:00 heroku[run.5087]: Awaiting client
2021-05-09T11:39:03.868781+00:00 heroku[run.5087]: Starting process with command restart
2021-05-09T11:39:03.872682+00:00 heroku[run.5087]: State changed from starting to up
2021-05-09T11:39:08.263164+00:00 heroku[run.5087]: Process exited with status 1
2021-05-09T11:39:08.325802+00:00 heroku[run.5087]: State changed from up to complete
2021-05-09T11:40:45.464779+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sws-wiki.herokuapp.com request_id=edfca19c-949e-4e13-b496-adcd6e33286b fwd="95.180.36.112" dyno= connect= service= status=503 bytes= protocol=https
2021-05-09T11:40:46.514332+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sws-wiki.herokuapp.com request_id=bbf65ba8-ecb4-47cd-ace8-83f0e8b66791 fwd="95.180.36.112" dyno= connect= service= status=503 bytes= protocol=https
and npm install -g

Please advise. Thanks

Collapse
 
yordanovdna profile image
Iliyan Yordanov

Hey all,

I tried with npm install serve --s and replacing my scripts in package.json, but when tested both on my local machine and heroku while run npm run start, after build, I got an error:

serve -s build
(node:25496) ExperimentalWarning: The ESM module loader is experimental.
file:///D:/Projects/Projects-on-React/my-portfolio-website/node_modules/serve/build/main.js:129
url.port = url.port ?? "3000";
^
SyntaxError: Unexpected token '?'

However, if I run it manualy by typing serve -s build it works, but it uses an old version of serve@^6.14.6

I tried to install this verion and deploy to heroku but it's saying that there is no such a verion.

Any thoughts on what it could be, and maybe how I can solve this?

Thanks in advance!

Image description

My pachage.json:

{
  "name": "my-portfolio-website",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "v12.18.3"
  },
  "description": "Iliyan Yordanov portfolio website.",
  "author": {
    "name": "Iliyan Yordanov",
    "email": "iliyanyyordanov@gmail.com"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.32",
    "@fortawesome/free-brands-svg-icons": "^5.15.1",
    "@fortawesome/free-regular-svg-icons": "^5.15.1",
    "@fortawesome/free-solid-svg-icons": "^5.15.1",
    "@fortawesome/react-fontawesome": "^0.1.11",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "ansi-regex": "^6.0.1",
    "axios": "^0.20.0",
    "bootstrap": "^4.5.3",
    "joi-browser": "^13.4.0",
    "jquery": "^3.5.1",
    "node-sass": "^4.14.1",
    "popper.js": "^1.16.1",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-helmet": "^6.1.0",
    "react-image-appear": "^1.3.26",
    "react-mail-form": "^2.1.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.3",
    "react-snapshot": "^1.3.0",
    "react-toastify": "^6.0.9",
    "serve": "^14.0.0"
  },
  "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"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Enter fullscreen mode Exit fullscreen mode
Collapse
 
lucidmach profile image
Nukala Suraj

I was stuck on H10 for a month,
My Fix was comment out all the dev dependencies

Collapse
 
ragrag profile image
Raggi

settings node version by using

 "engines": {
   "node": "12.11.1"
   }
Enter fullscreen mode Exit fullscreen mode

saved me lots of headaches, thanks man

Collapse
 
barriosdfreddy profile image
Barrios Freddy

Thank you a lot!!

Collapse
 
ngochang29397 profile image
jelly

Cool tips, the last one works for me! Thanks a lot

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

You are welcome. I glad this helped you out.

Collapse
 
gogatash profile image
gogatash

This was really helpful, thank you very much.
Indeed, the error was in the procfile

Collapse
 
vikraantnegi profile image
vikraantnegi • Edited

I am getting a H10 error, in the app.get('/') portion with a /favicon.ico error! I have no idea about it and ik there's a icon for the title but i didnt touch it in the whole project still its causing error

Collapse
 
nawazsharifb profile image
NawazSharifB

i am getting this error -

2021-01-12T10:58:37.082589+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nsb-inter-city-bus.herokuapp.com request_id=32b771a0-adcb-454c-ac96-f5281358c0c5 fwd="103.25.251.235" dyno= connect= service= status=503 bytes= protocol=https
2021-01-12T10:58:37.552199+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nsb-inter-city-bus.herokuapp.com request_id=1000b780-50ad-4a96-87b7-7b1f2e1bf562 fwd="103.25.251.235" dyno= connect= service= status=503 bytes= protocol=https

in my package.json-
"scripts": {
"heroku-postbuild": "ng build --prod",
"ng": "ng",
"start": "node index.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"engines": {
"node": "12.18.2",
"npm": "6.14.5"
},

in my Procfile-
web: node index.js

what is the solution please??

Collapse
 
shruti192 profile image
Shruti Shambhawi

I am getting the following error it has been the whole day but I am not able to resolve this please help (This is for my 1st webD project):-

Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch '/app/Problem_Set/Problem_urls/problem_url_1349.txt'

Collapse
 
visuospace profile image
visuospace

Thanks a lot! I made a mistake in procfile and nowhere in the world i was going to get this fixed! Thanks a lot! Saved a lot of time!

Collapse
 
lajaques profile image
Leonardo Jaques

Save lives! thanks!

Collapse
 
richrock191 profile image
Richard Wilson

This was really helpful, thank you very much.

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

Thanks. I am glad you find it helpful.

Collapse
 
ikxyz profile image
Ik Ben

This was really helpful Thanks

Collapse
 
damian96 profile image
Damian96

Thanks a lot for this article, although I might end up doing the Unthinkable :/ .

Collapse
 
aydarfz profile image
aydarfz • Edited

In my case I updated one of the API keys and forgot to swap it in the Heroku Config Vars of the project. Thanks for the article!

Collapse
 
harkiratsm profile image
Harkirat Singh

Thnx never thought about wrong spacing in Procfile

Collapse
 
itselfcg profile image
Itzel Contreras

Thanks! This helped me a lot.

Collapse
 
munsif12 profile image
Munsif Ali Misri

i just registered myself to only Thank you coz you saved my life .

Collapse
 
achenson profile image
achenson

What solved the problem for me (react with typescript project):

Clientside:

  • moved react-scripts, typescript and all @types/... dependencies out of dev dependencies in package.json

Serverside:

  • in package.json, scripts :

"start": "ts-node --transpile-only [your entry file].ts",
(leave out the --transpile-only flag if you don't have any type issues remaining)

  • deleted from package.json : "type": "module", be sure that "module": "commonjs" is present is tsconfig.json

more about the issue:
stackoverflow.com/questions/620962...

  • moved ts-node and typescript out of dev dependencies in package.json
    (this time all @types/... can remain in dev dependencies )

  • [also added to package.json, but I have not checked if this one is crucial]
    "engines": {
    "node": "14.x"
    },

Collapse
 
david2199 profile image
DavidGmidd

Hello everyone, I am getting the following error after deploying my app:

at=error code=H10 desc="App crashed" method=GET path="/" host=panthercrushlist.herokuapp.com request_id=77e3b920-d152-45c6-a908-bd7f2e58c76b fwd="140.233.174.71" dyno= connect= service= status=503 bytes= protocol=https
2021-04-29T20:05:15.230672+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=panthercrushlist.herokuapp.com request_id=6700b59a-f7fe-4864-a163-41a31b6cee50 fwd="140.233.174.71" dyno= connect= service= status=503 bytes= protocol=https
2021-04-29T20:34:09.456725+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=panthercrushlist.herokuapp.com request_id=4c53459a-ad78-4ba5-973b-e7f2864711c5 fwd="140.233.174.71" dyno= connect= service= status=503 bytes= protocol=https
2021-04-29T20:34:09.959440+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=panthercrushlist.herokuapp.com request_id=365fd8cb-9498-4b51-a59b-022ef919e708 fwd="140.233.174.71" dyno= connect= service= status=503 bytes= protocol=https

And I have NO IDEA how to approach it. Can someone help please?
Thank you in advance.

Collapse
 
anthonygualandri profile image
Anthony Gualandri

Thank you this helped me out a lot!

Collapse
 
pldk24 profile image
Philippe de Liedekerke

love the "Heroku restart" option... KISS as usual :)

Collapse
 
gledsonafonso profile image
Gledson Afonso

Had to login just to thank you. You saved my skin today, mate! Cheers!

Collapse
 
farbuscoder profile image
Marcos Fernández

Thank you man, it was so useful.

Collapse
 
surveyorjr profile image
Surveyor Jr

Ran into this on my Django app. Later on, realized I had not installed gunicorn 😂

Collapse
 
mestareddy_93 profile image
Edikan Bassey

Declaring my mongodb database on heroku solved my issue. I was having H10 error with 503 status.

Collapse
 
sitonimbus profile image
Carlos Andrés Mora González

I found this article very useful, thank you very much

Collapse
 
udithaishan profile image
Uditha Ishan

Thank you. this was very helpful for me.

Collapse
 
pranitingole profile image
Pranit ingole • Edited

Thanks

Collapse
 
alb_isma profile image
ismailalabou

i have a question, my scripts section in package.json don't contain a "heroku-postbuild": "npm run build", would this affect my deploy to heroku ?? @lawrence_eagles

Collapse
 
mathes_mk profile image
emkayee

you.. Mr. Lawerence - are a savior! May your rest of 2020 be wonderful!

Collapse
 
gabriellaamah profile image
Gabriella Amaefule

thank you so much Lawrence! this worked like magic

Collapse
 
ahmad-ali14 profile image
Ahmad Ali

Just rerun build again .. this will solve the problem

Collapse
 
suhasacharya profile image
Suhas Acharya

i get the same app crashed...im using Flask in Heorku

Collapse
 
commanderqueen profile image
commanderqueen

I cannot thank you enough for this! For me it turned out to be my Procfile pointing to the wrong server file and missing start script in my package.json. Thank you Lawrence!!

Collapse
 
lawrence_eagles profile image
Lawrence Eagles

I am glad this helped you solve your problem.

Collapse
 
joelsoncastro profile image
Joelson

Thank you very much, it was a Bug in the Procfile for me. This took me allot of hours.

Cheers

Collapse
 
leandroatallah profile image
Leandro Atallah

Thank you!

Collapse
 
chidinmanze profile image
Chidinma Nze

This was really helpful to me. Turns out my issue was from setting a port without the process.env variable option, which I already had set up.

Collapse
 
tonnyg95 profile image
Tonny

Broo thank you so so much i was freking out with deployment and your solution still works in Sep 2022 thank you so much i just create account to say thanks!

Collapse
 
adarsh2425 profile image
Adarsh S

Thanks a lot bro. You saved my code.Twice.

Collapse
 
preciousbata profile image
Precious Batta

please is the solution different when deploying flask web app.
Because i dont have an issue with my procfile yet i get an h10 application error

Collapse
 
ahnayef profile image
AHN

Very clean and understandable, worked in first try. Thanks

Collapse
 
robbinluo profile image
Robbin-Luo

No matter you believe or not, I tried everything mentioned here, but the error persists