简体   繁体   English

Heroku - “没有 web 进程正在运行”消息,但服务器已经启动

[英]Heroku - "No web processes running" message, but server already started

I'm facing the following issue with Heroku and my Node / Express / MongoDB app:我的 Heroku 和我的 Node / Express / MongoDB 应用程序面临以下问题:

XXXX-05-10T22:56:41.782988+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=fast-depths-03410.herokuapp.com request_id=d42d214e-051d-4ba9-842f-ad98cedaf4ab fwd="xxx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes= protocol=https

I saw in a lot of posts that this error is related to the dyno scale, but I think this is not the case.我在很多帖子中看到这个错误与dyno scale有关,但我认为并非如此。

As you can see in the below logs, the app is running:正如您在下面的日志中看到的,该应用程序正在运行:

XXXX-05-10T22:41:56.098412+00:00 app[api.1]: yarn run v1.22.5
XXXX-05-10T22:41:56.253837+00:00 app[api.1]: $ node index.js
XXXX-05-10T22:41:57.849610+00:00 app[api.1]: server started on port 23804 (development)

but when I'm trying to access to my Heroku app: https://fast-depths-03410.herokuapp.com/ The only thing I can see is the message但是当我尝试访问我的 Heroku 应用程序时: https://fast-depths-03410.herokuapp.com/我唯一能看到的是消息

Application error check the logs..."应用程序错误检查日志...”

Regarding my app, I've tried the following things:关于我的应用程序,我尝试了以下操作:

  • I've scaled the dyno with heroku ps:scale {myapp-name}=1我用heroku ps:scale {myapp-name}=1缩放了测功机
  • I've changed the listening port to use process.env.PORT我已将侦听端口更改为使用process.env.PORT
  • I've added EXPOSE $PORT in my Dockerfile我在我的Dockerfile中添加了EXPOSE $PORT

What is the problem, and how can I fix it?问题是什么,我该如何解决?

You have something running, but it's not a web process.你有一些东西在运行,但它不是web进程。 Your log shows an api process:您的日志显示一个api进程:

XXXX-05-10T22:41:57.849610+00:00 app[api.1]: server started on port 23804 (development)
                                     ^^^

For non-Docker deploys, process types are defined by your Procfile , and only web processes can receive traffic from the inte.net .对于非 Docker 部署,进程类型由您的Procfile定义, 只有web进程可以接收来自 inte.net 的流量 In this scenario, change your Procfile from在这种情况下,将您的Procfile

api: some command

to

web: some command

and redeploy.并重新部署。

If you are using Docker, make sure to use web for your process-type when you build and push your image and later when you release it, eg:如果您使用的是 Docker,请确保在构建和推送映像以及稍后发布映像时使用web作为您的process-type ,例如:

heroku container:push web
heroku container:release web

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

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