部署到 Heroku 的 Vapor 应用程序出现问题
A problem with Vapor app deployed to Heroku
我已经将我的 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)
如何解决这个问题?
我用 PostgreSQL 替换 SQLite 解决了这个问题。我没有在 Heroku 上找到任何关于 SQLite 支持的信息,但似乎不支持这个数据库(或者我做错了什么)。
我已经将我的 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)
如何解决这个问题?
我用 PostgreSQL 替换 SQLite 解决了这个问题。我没有在 Heroku 上找到任何关于 SQLite 支持的信息,但似乎不支持这个数据库(或者我做错了什么)。