【发布时间】:2021-09-18 04:44:31
【问题描述】:
我遇到了一个非常奇怪的错误。
我于 6 月 18 日在 Heroku 上部署了我的 Strapi 应用程序,它运行良好。
现在 19 天后,我对我的应用进行了一些更改并再次将其推送到 Heroku,但它开始出现 h10 错误。
错误类似于:
2021-07-07T15:22:28.510738+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-07-07T15:22:28.510819+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-07-07T15_22_28_486Z-debug.log
2021-07-07T15:22:28.610051+00:00 heroku[web.1]: Process exited with status 1
2021-07-07T15:22:28.715261+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-07T15:22:29.185674+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=oncore-project-strapi.herokuapp.com request_id=f60afffe-f974-4512-8129-ab45f1f45724 fwd="119.160.97.153" dyno= connect= service= status=503 bytes= protocol=https
2021-07-07T15:22:35.505269+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=oncore-project-strapi.herokuapp.com request_id=cf7d35af-1539-4cb7-8405-1e2a8c8c23f5 fwd="119.160.97.153" dyno= connect= service= status=503 bytes= protocol=https
棘手的部分是这些天我没有更改任何配置。我刚刚在 Strapi 内部工作并添加了一些内容类型并编辑了现有的内容类型。
我的 Production database.js 文件如下所示:
const { parse } = require("pg-connection-string");
module.exports = ({ env }) => {
const { host, port, database, user, password } = parse(env("DATABASE_URL"));
return {
defaultConnection: "default",
connections: {
default: {
connector: "bookshelf",
settings: {
client: "postgres",
host,
port,
database,
username: user,
password,
ssl: {
rejectUnauthorized: false,
},
},
options: {
ssl: true,
},
},
},
};
};
它位于 ./config/env/production/database.js
而我的生产级 server.js 看起来像这样:
module.exports = ({ env }) => ({
url: env("HEROKU_URL"),
});
它驻留在 ./config/env/production/server.js 上。
我还阅读了 Strapi 论坛和 Github repo 上的相关问题。大多数解决方案都说我需要更改 database.js 文件以进行 SSL 更改。 Heroku 在 2021 年 3 月推出了这些更改。但我的应用程序在 6 月 18 日使用此配置设置。
顺便说一句,我也尝试了这些设置,但它对我不起作用。
请帮我解决这个问题。
P.S:我从这个 repo 引导了我的 strpi 项目:GitHub -strapi/strapi-starter-next-blog: Strapi Starter Next Blog
谢谢!
【问题讨论】:
标签: node.js postgresql heroku deployment strapi