简体   繁体   English

“没有 web 进程正在运行”Heroku 上的错误,部署 Fastapi

[英]"No web processes running" Error on Heroku , Deploying Fastapi

I am trying to host FASTAPI apis on Heroku, but I keep facing this error我正在尝试在 Heroku 上托管 FASTAPI api,但我一直面临这个错误

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在参考了所有类似的帖子之后, 就像这个我发现heroku ps:scale web=1可以工作,但我的问题是

  1. There is no mention of where to run this command.没有提到在哪里运行这个命令。

  2. Should this be added it to my proctfile?应该将其添加到我的 proctfile 中吗?

  3. I tried running it in the Heroku Run Console on the web.我尝试在 web 上的 Heroku Run Console中运行它。 but it returned bash: heroku: command not found但它返回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由于 windows 不支持 Gunicorn(Fastapi 需要),因此我也无法执行heroku run local

My proctfile looks like this我的 proctfile 看起来像这样

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

I found the error to be in the Procfile.我发现错误在 Procfile 中。 Changed the Procfile to将 Procfile 更改为

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

and then it worked.然后它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM