Heroku shows Application error and H10 after deploying an Express app
at=error code=H10 desc="App crashed" method=GET path="/"Short answer
H10 means the web dyno crashed or never started. The log lines just before it name the reason. For a first Node.js deploy it is nearly always a missing web command (no Procfile and no start script), a misnamed Procfile, or an error thrown while booting the app.
Fix it fast
1Find out which cause you have
Stream the logs and reload the page. Read the lines from the dyno, not just the router line with H10.
heroku logs --tail2Match what you see, then jump to its fix
- 1
The dyno starts and exits straight away, and no Procfile or start script existsNo web process is definedFix - 2
You wrote a Procfile, but the dyno still does not start the command in itThe Procfile has the wrong name or is in the wrong folderFix - 3
A stack trace in the app[web.1] lines, then Process exited and crashedThe app throws an error while startingFix - 4
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launchThe web process does not bind to the port Heroku assigns in timeFix
- 1
What does the error look like?
at=error code=H10 desc="App crashed" method=GET path="/"State changed from starting to crashedstatus=503
Cause 1 of 4
No web process is defined
1Check
Heroku uses the Procfile first. With no Procfile, it falls back to the start script in package.json. With neither, nothing serves traffic.
ls Procfile
grep -n "\"start\"" package.json2Fix
Add a start script, or a Procfile with a web line, and deploy again.
# package.json
"scripts": { "start": "node server.js" }
# or Procfile
web: node server.js3Verify
Deploy and check that the dyno is up.
git push heroku main
heroku psConfirmed by devcenter.heroku.com
Cause 2 of 4
The Procfile has the wrong name or is in the wrong folder
1Check
The file must be named Procfile with no extension, and it must sit in the app's root directory.
git ls-files | grep -i procfile2Fix
Rename it and move it to the repository root, then commit.
git mv Procfile.txt Procfile
git commit -m "Fix Procfile name"3Verify
Push and read the first lines of the dyno log.
git push heroku main
heroku logs --tailConfirmed by devcenter.heroku.com
Cause 3 of 4
The app throws an error while starting
1Check
The H10 page shows exactly this pattern: an error from the app, then the process exits. Common sources are a missing package, a bad config value, or code that needs a config var that is not set.
heroku logs --num 200
heroku config2Fix
Fix what the stack trace names, set missing config vars, and deploy again.
heroku config:set DATABASE_URL="postgres://example"3Verify
The dyno shows as up and the page loads.
heroku ps
heroku openConfirmed by devcenter.heroku.com
Cause 4 of 4
The web process does not bind to the port Heroku assigns in time
1Check
A boot timeout also shows H10. The web process has 60 seconds to bind to the port Heroku gives it.
grep -rn "listen(" server.js2Fix
Listen on the port from the environment.
const port = process.env.PORT || 3000;
app.listen(port);3Verify
Redeploy; the R10 line should not appear.
heroku logs --tailConfirmed by devcenter.heroku.com
How do I stop it coming back?
- Define the web command in a start script or a Procfile before the first deploy.
- Run npm start locally with NODE_ENV=production to see crashes before pushing.
- Set every required config var with heroku config:set before the release.
- Pin the Node.js version in package.json engines to a supported release line.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Heroku kills a Node.js app that does not bind to $PORT in time
Stopping process with SIGKILL
Heroku gives a web process 60 seconds to listen on the port it assigns in $PORT, then kills it with R10.
3 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
Axios call from a React app comes back 404
404 (Not Found)
Status code 404 means a server answered, but it has nothing at that path.
3 causes, each with a fixBack end
bcrypt.hash throws 'data and salt arguments required'
Error: data and hash arguments required
The bcrypt package throws this when hash gets null or undefined for the password or for the salt.
4 causes, each with a fixBack end
bcryptjs rejects hash() or compare() with Illegal arguments
Error: Illegal arguments: string, undefined
bcryptjs checks the types of its two arguments and, when either is wrong, throws Illegal arguments followed by the typeof of the first and the second.
3 causes, each with a fixBack end
Express warns 'body-parser deprecated undefined extended'
body-parser deprecated undefined extended
The warning appears because urlencoded() was called without the extended option, which body-parser 1.x has warned about since version 1.4.0.
3 causes, each with a fix