'Why is heroku giving error code H81 on deployment of react app

Im deploying full stack react app to heroku.

I followed the steps provided on heroku using the cli

-logged in using my credentials

-ran heroku create

-added the heroku origin using the new git repo

-then ran git push heroku master

when i run heroku open the page displays:

cannot get /

the heroku logs are returning this:

2018-10-04T00:00:29.405636+00:00 app[api]: Release v1 created by user [email protected]
2018-10-04T00:00:29.405636+00:00 app[api]: Initial release by user [email protected]
2018-10-04T00:00:29.533165+00:00 app[api]: Release v2 created by user [email protected]
2018-10-04T00:00:29.533165+00:00 app[api]: Enable Logplex by user [email protected]
2018-10-04T00:36:33.757703+00:00 app[api]: Set GOOGLE_CLIENT_ID config vars by user [email protected]
2018-10-04T00:36:33.757703+00:00 app[api]: Release v3 created by user [email protected]
2018-10-04T00:37:00.603959+00:00 app[api]: Release v4 created by user [email protected]
2018-10-04T00:37:00.603959+00:00 app[api]: Set GOOGLE_CLIENT_SECRET config vars by user [email protected]
2018-10-04T00:37:34.970708+00:00 app[api]: Set GOOGLE_REFRESH_TOKEN config vars by user [email protected]
2018-10-04T00:37:34.970708+00:00 app[api]: Release v5 created by user [email protected]
2018-10-04T00:38:45.657558+00:00 app[api]: Release v6 created by user [email protected]
2018-10-04T00:38:45.657558+00:00 app[api]: Set GOOGLE_ACCESS_TOKEN config vars by user [email protected]
2018-10-04T01:48:46.925080+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=boiling-ocean-24541.herokuapp.com request_id=b3728a9b-299e-4db2-aa2f-72f7d594a446 fwd="184.181.111.193" dyno= connect= service= status=502 bytes= protocol=https
2018-10-04T01:48:47.400822+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=boiling-ocean-24541.herokuapp.com request_id=27da54d0-1040-4eac-b847-897edf10b7ea fwd="184.181.111.193" dyno= connect= service= status=502 bytes= protocol=https
2018-10-04T01:51:50.000000+00:00 app[api]: Build started by user [email protected]
2018-10-04T01:52:25.692316+00:00 app[api]: Deploy 4371d707 by user [email protected]
2018-10-04T01:52:25.718815+00:00 app[api]: Scaled to web@1:Free by user [email protected]
2018-10-04T01:52:25.692316+00:00 app[api]: Release v7 created by user [email protected]
2018-10-04T01:52:29.662530+00:00 heroku[web.1]: Starting process with command `npm start`
2018-10-04T01:52:27.000000+00:00 app[api]: Build succeeded
2018-10-04T01:52:32.304480+00:00 app[web.1]:
2018-10-04T01:52:32.304504+00:00 app[web.1]: > node index.js
2018-10-04T01:52:32.304505+00:00 app[web.1]:
2018-10-04T01:52:32.304502+00:00 app[web.1]: > [email protected] start /app
2018-10-04T01:52:32.644938+00:00 app[web.1]: Server listening on port 9785
2018-10-04T01:52:33.468164+00:00 heroku[web.1]: State changed from starting to up
2018-10-04T01:52:35.091471+00:00 heroku[router]: at=info method=GET path="/" host=boiling-ocean-24541.herokuapp.com request_id=4ab1f8c2-2d47-4345-bbcd-a370055c0061 fwd="184.181.111.193" dyno=web.1 connect=1ms service=13ms status=404 bytes=415 protocol=https
2018-10-04T01:52:35.271535+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=boiling-ocean-24541.herokuapp.com request_id=126193f7-90d7-42b4-ad2d-7b52f6e295ca fwd="184.181.111.193" dyno=web.1 connect=0ms service=3ms status=404 bytes=426 protocol=https
2018-10-04T01:53:35.000000+00:00 app[api]: Build started by user [email protected]
2018-10-04T01:54:11.896509+00:00 heroku[web.1]: Restarting
2018-10-04T01:54:11.897285+00:00 heroku[web.1]: State changed from up to starting
2018-10-04T01:54:11.607628+00:00 app[api]: Deploy 4371d707 by user [email protected]
2018-10-04T01:54:12.851484+00:00 heroku[web.1]: Stopping all processes with SIGTERM

from the heroku docs on this error code, its saying that this is because the app has not been deployed to git but i have already done so. And when i try to push the code again it returns "everything is up to date".



Solution 1:[1]

It looks like you're not waiting until the end of your deployment to make a request.

2018-10-04T01:48:47.400822+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=boiling-ocean-24541.herokuapp.com request_id=27da54d0-1040-4eac-b847-897edf10b7ea fwd="184.181.111.193" dyno= connect= service= status=502 bytes= protocol=https

Then, 3 seconds later:

2018-10-04T01:51:50.000000+00:00 app[api]: Build started by user [email protected] 2018-10-04T01:52:25.692316+00:00 app[api]: Deploy 4371d707 by user [email protected]

A few seconds later, we can see the build succeeds:

2018-10-04T01:52:27.000000+00:00 app[api]: Build succeeded

Then app is then started, and 2 requests are made:

2018-10-04T01:52:35.091471+00:00 heroku[router]: at=info method=GET path="/" host=boiling-ocean-24541.herokuapp.com request_id=4ab1f8c2-2d47-4345-bbcd-a370055c0061 fwd="184.181.111.193" dyno=web.1 connect=1ms service=13ms status=404 bytes=415 protocol=https 2018-10-04T01:52:35.271535+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=boiling-ocean-24541.herokuapp.com request_id=126193f7-90d7-42b4-ad2d-7b52f6e295ca fwd="184.181.111.193" dyno=web.1 connect=0ms service=3ms status=404 bytes=426 protocol=https

No H81 anymore. I don't know what happened on your end, but it appears there were indeed no deploys when you made the first request. The deploy started a few seconds later, and once it was finished, the requests made it through to the app properly.

Solution 2:[2]

Push an empty commit to Heroku to re-trigger the deployment:

git commit --allow-empty -m "Trigger deployment"
git push heroku HEAD:master

You can overwrite this empty deploy on the next push of master:

git push heroku HEAD:master -f

Solution 3:[3]

I was facing that annoying error as well, but after running heroku config:set DISABLE_COLLECTSTATIC=1 and then git push heroku HEAD:master it worked!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Damien MATHIEU
Solution 2 Harald Nordgren
Solution 3 Mr Coolman