Slow build time makes Heroku deployment to fail
See original GitHub issueHi Jared,
I just tried to deploy an app I’ve been working on for the last month to Heroku. After deploying I got the following errors:
2016-06-08T15:20:14.906386+00:00 app[web.1]: > npm run clean && npm run build && cross-env NODE_ENV=production node ./build/server
2016-06-08T15:20:14.906349+00:00 app[web.1]:
2016-06-08T15:20:16.312074+00:00 app[web.1]: > rm -rf build
2016-06-08T15:20:16.312075+00:00 app[web.1]:
2016-06-08T15:20:17.182897+00:00 app[web.1]: > react-production-starter@0.1.0 build /app
2016-06-08T15:20:17.182898+00:00 app[web.1]: > webpack -p --config ./webpack.config.prod.js && webpack -p --config ./webpack.server.config.prod.js
2016-06-08T15:20:17.182899+00:00 app[web.1]:
2016-06-08T15:21:12.058454+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-08T15:21:12.058454+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-08T15:21:13.159176+00:00 heroku[web.1]: Process exited with status 137
2016-06-08T15:21:13.174340+00:00 heroku[web.1]: State changed from starting to crashed
It looks like the build
script takes more then 60 seconds which make Heroku think it failed.
I guess that I could run the build locally and commit the files and skip building altogether but I wonder if there’s a better way?
Any suggestions?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Tip: Debugging slow Heroku builds - Boring Rails
Tip: Debugging slow Heroku builds ... It's always best to follow a systematic approach when trying to speed up slow code. First, measure...
Read more >heroku deploy taking very long - Stack Overflow
Try using bundle package to cache the downloaded . gem files, and then run git add . && git commit -m "Vendor in...
Read more >Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack.
Read more >Limits | Heroku Dev Center
However, in general, slow boot times will make it harder to deploy your application and will make recovery from dyno failures slower, ...
Read more >Preventing H12 Errors (Request Timeouts) - Heroku Dev Center
After optimizing slow transactions and resource usage, adjust concurrency settings. The ideal concurrency level blends desired response times ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ranyefet This is a rather old issue, but I just want to add a point in addition to the other solutions suggested here. I ran into this problem lately and weren’t able to solve things by specifying listening port to process.env.PORT like most people suggested, or removing packages from build dependencies (I do need all the packages!)
So in the end I figured out by adding the npm run build, or webpack -p, whatever you are using to build the project, into the post-install scripts inside package.json.
for example, this can be your package.json’s script field:
By doing this heroku will attempt to build the project after you have pushed the code to heroku server, but before it enforces the 60 seconds timeout.
You do not need to build things locally, add them to git repo, and push.
@ctrlplusb sweet, i actually just found this:
"heroku-postbuild": "npm run build"
https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process
worked like a charm.