【发布时间】:2020-05-01 17:08:10
【问题描述】:
我已将我的 Vapor 应用部署到 Heroku,但是当我尝试发出请求时,它失败并出现以下错误:
at=error code=H10 desc="App crashed" method=GET path="/feed" host=detect-api.herokuapp.com request_id=970e4005-58b0-4b34-8489-715dc9cd5e19 fwd="5.228.26.4" dyno= connect= service= status=503 bytes= protocol=https
另外,当我运行这个脚本 - heroku ps:scale web=1 时,我会得到下一个日志:
State changed from crashed to starting
State changed from starting to crashed
我的 Procfile 包含下一个代码:
web: Run serve --env production --hostname 0.0.0.0 --port $PORT
在configure.swift 文件中我添加了以下代码:
let nioServerConfig = NIOServerConfig.default(
hostname: "0.0.0.0",
port: Int(Environment.get("PORT") ?? "") ?? 8080
)
services.register(nioServerConfig)
如何解决这个问题?
【问题讨论】: