1

I am trying to host FASTAPI apis on Heroku, but I keep facing this error

at=error code=H14 desc="No web processes running" method=GET path="/" host=myapp-api.herokuapp.com request_id=09d8bd62-bcf7-4738-a747-fb3cdd8cd7f7 fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https
heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=myapp-api.herokuapp.com request_id=92d2cfd5-c0d8-4696-9e79-8f0bb7231bce fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https

After referring all the similar post , like this one I found that heroku ps:scale web=1 could work , but my issue is

  1. There is no mention of where to run this command.

  2. Should this be added it to my proctfile ?

  3. I tried running it in the Heroku Run Console on the web. but it returned bash: heroku: command not found

  4. Since Gunicorn ( Required by Fastapi ) is not supported in windows, and thus I am also unable to do heroku run local

My proctfile looks like this

web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app -p $PORT

My full error log

2022-07-21T08:53:20.000000+00:00 app[api]: Build succeeded
2022-07-21T08:53:26.112645+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=myapp-api.herokuapp.com request_id=9efd5f28-4aa3-4aac-91b0-bc89b8da1d1b fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https
2022-07-21T08:53:26.949447+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=myapp-api.herokuapp.com request_id=b03f8ca4-63e3-48c7-9349-2339fa0a4dc7 fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https
2022-07-21T08:54:12.000000+00:00 app[api]: Build started by user dummyuserid
2022-07-21T08:54:35.485193+00:00 app[api]: Release v14 created by user dummyuserid
2022-07-21T08:54:35.485193+00:00 app[api]: Deploy 6d456f91 by user dummyuserid
2022-07-21T08:54:37.460184+00:00 heroku[worker.1]: State changed from crashed to down
2022-07-21T08:54:45.000000+00:00 app[api]: Build succeeded
2022-07-21T08:55:08.908036+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=myapp-api.herokuapp.com request_id=5f961c83-9dfd-4346-9511-420cbd0bee6e fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https
2022-07-21T08:55:09.686828+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=myapp-api.herokuapp.com request_id=062ef29f-c702-4963-8eb6-4ec09a9c1d7d fwd="103.99.148.171" dyno= connect= service= status=503 bytes= protocol=https
2
  • 1
    1. In Heroku CLI, you are correct in point 3. - 2. No. - 3a. You need to install the Heroku CLI in order to use it. 3b. You can use the Heroku Dyno site. Your app > Resources > there should be your Procfile and you need to reenable that. - 4. Gunicorn is not required and you should start your app without that since a very common problem is that many projects are not compatible with running the same project multiple times. - 5. You should provide the entire log from the moment you enable your web process, see 3. Commented Jul 21, 2022 at 8:31
  • Note that the Procfile must be named Procfile exactly. There is no t, it must have a capital P, and it cannot have any extension. You have typed proctfile at least twice here. (This is unlikely to be related to your problem, just an important note.) Commented Jul 21, 2022 at 11:08

1 Answer 1

0

I found the error to be in the Procfile. Changed the Procfile to

web uvicorn main:app --host=0.0.0.0 --port=${PORT:-5000}

and then it worked.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.