Hey there,
Sorry to post another issue so shortly after my last but I'd really appreciate some help with this issue. Basically, I have combined an existing reactjs with this reactGo, got it to work locally (both running "dev" command and building), but when I deploy to heroku I get the following errors:
2017-05-10T21:42:25.411566+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-05-10T21:42:25.411630+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-05-10T21:42:25.441345+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2017-05-10T21:42:25.594964+00:00 heroku[web.1]: Process exited with status 22
2017-05-10T21:43:59.732215+00:00 heroku[web.1]: Process running mem=543M(106.1%)
2017-05-10T21:43:59.732277+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-05-10T21:44:13.716290+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-05-10T21:44:13.716376+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-05-10T21:44:13.741192+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2017-05-10T21:44:13.966647+00:00 heroku[web.1]: State changed from starting to crashed
2017-05-10T21:44:13.954005+00:00 heroku[web.1]: Process exited with status 22
2017-05-10T21:44:16.287420+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=d4b52f95-a50e-4579-84a0-3b7411726415 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:44:24.777756+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=1463bd52-de1d-4351-960d-aedf412c622a fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:44:25.694845+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=boiling-spire-17544.herokuapp.com request_id=7735e9de-bc4d-4535-b06e-b004b9cc4c8b fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:47:47.310866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=de042817-c34a-45e1-88ba-03eaeb78dd19 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:47:48.232781+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=boiling-spire-17544.herokuapp.com request_id=8edae68e-5bb8-444e-94e3-cffafb392b15 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
I've ommitted some non related parts of the log. Anyone here know what I'm doing wrong? Thanks
Confirmed. Only fix is to restart and let it build again heroku ps:restart web.1.
@jrodl3r Unfortunately that doesn't fix it for me.
The weird thing is that if I run "heroku run bash" and then "npm start", I don't receive any errors and it looks like everything is working. It only fails when I try to access the actual site.
@gittestcoder it must be something in the codes then... are you using a fresh build? or have you made changes, etc.?
@jrodl3r Yes that's correct, I've combined another project that I had been developing for a while with this boilerplate because I wanted to get server side rendering. I think the problem is that it takes >60 seconds to build my project because of all the dependencies... is there no way to get around this on heroku?
When I run "npm start" on heroku's bash it takes around 100 seconds, as you can see here:
There's got to be some way around this right? Otherwise how could you ever deploy mid-large sized applications to heroku?
I think I may have found a clue....
I'm getting a warning when I run the start script on heroku bash:
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
But I'm not using a database and am setting the database to none in the env.js file like this:
export const DB_TYPE = DB_TYPES.NONE;
So why do I need connect.session()?
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
This is happening to me too when deploying to Heroku. Apparently the build process is taking too long.
@gittestcoder @agroves333 Will you try again after deleting engines section from packages.json?
I tried to find a solution for this, but all failed except this.
Another possible solution is to change Procfile's web into worker, then type heroku ps:scale web=0 --app YOUR_APP_NAME and heroku ps:scale worker=1 --app YOUR_APP_NAME
But, it failed for me.
@ZeroCho I tried both solutions, neither worked. And when I tried the second solution, I get the error "No web processes running". Thanks for trying to help though, this is pretty frustrating.
@gittestcoder I suffered the same case two days ago. I don't know how and why, but after several restart of dyno by typing
heroku ps:scale web=0 --app YOUR_APP_NAME and heroku ps:scale web=1 --app YOUR_APP_NAME,
problem sovled.
Ah, one thing I did was removing postinstall script and pushing to heroku, and then adding postinstall back and pushing to heroku.
@ZeroCho Do you mean do that after changing Procfile's web into worker? Or keep it at the original web value and doing that?
keep original web value. I guess changing it into worker doesnt work
Thanks for the suggestion but that still doesn't help...
What eventually worked for me was to change webpack's devtools from 'sourcemap' to 'eval' and uninstall the test suites to cut down on build time. But this is unacceptable since we need sourcemap for production builds as well as unit tests. It's a matter of "cutting the fat" off of any unneeded items. I'm still unsure what is causing the client and server bundles to take so long on Heroku.
Maybe it's the fact that npm start currently builds our code with webpack in the Procfile.
@agroves333 Thanks, how can I make sure the tests don't run? Just remove the "test" script from package.json?
@choonkending Thanks for the input. Any suggestion on how to change that?
@gittestcoder You'll have to remove all test related packages to reduce the build, not just the test script which runs them once built. But again, this is not the end solution since we need unit test. @choonkending I believe that without a Procfile, npm start will be ran by default. So not sure if that will help.
In my scripts part of my package json, I have something like this now:
{
"start": "cross-env NODE_ENV=production node compiled/server.js",
"heroku-postbuild": "npm run build"
}
Basically moved the npm run build off the npm start which adds to the time that heroku calculates for boot time.
That fixed a bunch of timing out issue on my end. Hope this helps you.
One thing I've found: DO NOT USE npm prestart. USE npm postinstall
@ZeroCho thank you fo the input! I was having a similar issue on a different project, I have been going crazy about it but this fixed it! Thank you so much!
Most helpful comment
One thing I've found: DO NOT USE npm prestart. USE npm postinstall