How can I fix Error R10 (Boot timeout) on Gatsby JS?

Viewed 400

I want to set up Gatsby on Heroku. I have followed the steps from https://www.gatsbyjs.org/docs/deploying-to-heroku/ and created a Procfile as described here https://devcenter.heroku.com/articles/procfile, but I'm still getting a timeout error on deploy. It seems like the port is starting to work, but for some reason it stops.

I've tried different lines to put in Procfile, but none of them worked. Currently I have web: gatsby serve --port $PORT - this is the last thing that I've tried putting in this file. Also I tried with web: npm start -- --port $PORT and other options that can be googled easily.

2019-10-24T23:06:52.707649+00:00 app[web.1]: 
2019-10-24T23:07:49.930330+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-10-24T23:07:49.910127+00:00 heroku[web.1]: Process exited with status 137
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2019-10-24T23:06:52.444262+00:00 app[web.1]: ║   To learn more, checkout https://gatsby.dev/telemetry                 ║
2019-10-24T23:06:52.444263+00:00 app[web.1]: ║                                                                        ║
2019-10-24T23:06:52.444264+00:00 app[web.1]: ╚════════════════════════════════════════════════════════════════════════╝
2019-10-24T23:06:52.445563+00:00 app[web.1]: 
2019-10-24T23:06:52.707515+00:00 app[web.1]: [2K[1A[2K[Ginfo gatsby serve running at: http://localhost:4563/
2019-10-24T23:06:52.707649+00:00 app[web.1]: 
2019-10-24T23:07:49.930330+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-10-24T23:07:49.910127+00:00 heroku[web.1]: Process exited with status 137

Any ideas how can I get it working?

1 Answers

You would want to use gatsby build and not gatsby serve as the latter is meant for testing locally. gatsby build will give you static assets and speed optimizations. Try to remove the Procfile and then Heroku should catch the build command in package.json.

Related