Strapi v4 Heroku deployment error R10 failed to bind to $PORT within 60 seconds of launch

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Suddently my strapi app doesnt start on Heroku.
I get
2022-05-05T16:17:07.706680+00:00 heroku[web.1]: State changed from crashed to starting
2022-05-05T16:17:23.728871+00:00 heroku[web.1]: Starting process with command npm start
2022-05-05T16:17:26.141070+00:00 app[web.1]:
2022-05-05T16:17:26.141086+00:00 app[web.1]: > thecoach-strapi@0.1.0 start
2022-05-05T16:17:26.141086+00:00 app[web.1]: > strapi start
2022-05-05T16:17:26.141087+00:00 app[web.1]:
2022-05-05T16:18:24.309979+00:00 heroku[web.1]: Error R10 (Boot timeout) → Web process failed to bind to $PORT within 60 seconds of launch
2022-05-05T16:18:24.412512+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-05-05T16:18:24.729274+00:00 heroku[web.1]: State changed from starting to crashed
2022-05-05T16:18:24.615552+00:00 heroku[web.1]: Process exited with status 137
2022-05-05T16:18:28.384472+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path="/" host=thecoach-dashboard.herokuapp.com request_id=8e204215-ffbe-4c01-9cac-aad58f39b2cd fwd=“46.176.152.89” dyno= connect= service= status=503 bytes= protocol=https
2022-05-05T16:18:31.243249+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=thecoach-dashboard.herokuapp.com request_id=04d4f3f0-ac39-4f98-a198-13a039859a6b fwd=“46.176.152.89” dyno= connect= service= status=503 bytes= protocol=https

I read arround about Heroku dynamic ports but no lack so far.

Did you find some fix? because i couldn’t

I have been having the same issue as well with Heroku and v4.

Actually not yet. I waited a couple of hours and the app opened by iitself. Like the port resolved on its own. I will push some updates and see if heroku somehow fixed that or its still an issue.

i downgraded to v4.1.8 fresh strapi and it worked

Im am at v4.1.8 already. Havent upgraded to the latest yet. Happened to me again today. A couple of push and deploys were succesfull but the last push got me an R10 (Boot timeout) → Web process failed to bind to $PORT within 60 seconds of launch. Something is happening with heroku generally. Last time the app started without doing anything to it.

I ended app creating a new app with the same files. It started.
Now i have setted up a staging app in order to have a backup of the stable. When i get the same error, i remove the problematic app, create a new one , and then copy the db from the stable one. I hope someone can point the real reason about the R10 issue so i would stop doing that.

To be of any help to people having issues on Heroku Hobby and Postgres heres what i do to add new fields to existing content types with data in them.

First i download the backup of db from Heroku and put it in my local Postgres

heroku pg:backups:capture --app my-app-name
heroku pg:backups:download backupid --app my-app-name

pg_restore -d local_dbname latest.dump

After that i open the local strapi connected on my local postgre and add all the fields i need to collections. After that i dump the local db, reset heroku db and import new dump.

pg_dump -Fc --no-acl --no-owner -h localhost -U username dbname > mydb.dump
heroku pg:reset --app my-app-name
pg_restore --verbose --no-acl --no-owner -U herokudb_username -h  herokudb_location -p 5432 -d herokudb_name < mydb.dump

I connect my local strapi to remote postgres just to be sure everything working.
If you ever get an error like duplicate key value violates unique constraint its an error due to dump (Postgres error not strapi), just manualy increment the key in the error

//Duplicate id key in admin_permissions table
SELECT SETVAL((SELECT PG_GET_SERIAL_SEQUENCE('"admin_permissions"', 'id')), (SELECT MAX(id) FROM admin_permissions) + 1, FALSE);

Then push my changes to heroku and open the app. Everything is looking working so far.
Strapi Version:4.1.11
pg:8.6.0
Postgres:14.0.2

I’m facing the same issue. Once the app worked all of a sudden after a couple of hours or two. But then now i’m stuck! everytime i create a new app it works fine and thats it! when I push a change then I get this error. I’m using the free dynos and i’m not sure that’s causing the issue. Anybody here using paid dynos facing teh same issue?