将Strapi部署到生产Heroku数据库

时间:2020-09-22 11:26:57

标签: heroku knex.js strapi heroku-postgres

我有一个更新的Strapi站点,运行的是V3.1.4-我们来自V3.0.6站点,结构更改很少。 Strapi可以在我的本地版本上连接到Postgres,一切都很好,但是部署到Heroku时会变得更加复杂。

我有一个使用Heroku Hobby数据库的暂存站点,其中包含以下软件包:

"knex": "^0.20.10",
"pg": "^8.0.3",
"pg-connection-string": "^2.3.0",

我的配置使用:

options: {
        pool: {
          min: 0,
          max: 18,
          createTimeoutMillis: 30000,
          acquireTimeoutMillis: 600000,
          idleTimeoutMillis: 30000
        }
      }

并且SSL设置为false。

这运行良好,但是如果我随后将其部署到“实时”(即使用需要SSL的生产数据库),则会出现以下错误:

[DATABASE] [10-1] sql_error_code = 28000 FATAL: no pg_hba.conf entry for host "3.249.190.208", user "XXX", database "XXX", SSL off

我以前有过,根据this post,我已经将PG降到了V7.4.3,但是随后出现此错误:

error KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

并且没有人不能通过更改任何您的池设置来使它起作用,包括使用:

ssl:true,
rejectUnauthorized: false,

节点和NPM设置为:

  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },

我认为我已经阅读了有关该主题的大多数帖子,但似乎没有任何效果。任何想法都收到了。

1 个答案:

答案 0 :(得分:1)

经过更多搜索并关注<!-- <button type="submit" class="btn btn-success btn-lg mt-2" id="Info"> --> <button type="submit" class="btn btn-success btn-lg mt-2" id="Hello"> Jump to Hello </button> 导致的自签名问题之后,我浏览了https://github.com/strapi/strapi/pull/6050,这有助于解决该问题。

相关问题