簡體   English   中英

Heroku - “沒有 web 進程正在運行”消息,但服務器已經啟動

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

我的 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

我在很多帖子中看到這個錯誤與dyno scale有關,但我認為並非如此。

正如您在下面的日志中看到的,該應用程序正在運行:

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)

但是當我嘗試訪問我的 Heroku 應用程序時: https://fast-depths-03410.herokuapp.com/我唯一能看到的是消息

應用程序錯誤檢查日志...”

關於我的應用程序,我嘗試了以下操作:

  • 我用heroku ps:scale {myapp-name}=1縮放了測功機
  • 我已將偵聽端口更改為使用process.env.PORT
  • 我在我的Dockerfile中添加了EXPOSE $PORT

問題是什么,我該如何解決?

你有一些東西在運行,但它不是web進程。 您的日志顯示一個api進程:

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

對於非 Docker 部署,進程類型由您的Procfile定義, 只有web進程可以接收來自 inte.net 的流量 在這種情況下,將您的Procfile

api: some command

web: some command

並重新部署。

如果您使用的是 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