【问题标题】:A problem with Vapor app deployed to Heroku部署到 Heroku 的 Vapor 应用程序出现问题
【发布时间】: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)

如何解决这个问题?

【问题讨论】:

    标签: swift xcode heroku vapor


    【解决方案1】:

    我通过用 PostgreSQL 替换 SQLite 解决了这个问题。我没有在 Heroku 上找到任何关于 SQLite 支持的信息,但似乎不支持这个数据库(或者我做错了什么)。

    【讨论】:

      猜你喜欢
      • 2018-08-02
      • 2017-01-26
      • 2014-11-25
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-30
      相关资源
      最近更新 更多