【问题标题】:since Postgres 13 can't connect from heroku-app to hobby-dev db without ssl因为 Postgres 13 无法在没有 ssl 的情况下从 heroku-app 连接到 hobby-dev db
【发布时间】:2021-02-25 23:03:29
【问题描述】:

我有一个连接到 postgres 的节点应用程序。 我几个月前在 Heroku 上设置的版本,作为插件 Heroku Postgres 12,与提供的 DATABASE_URL 连接没有问题。

当我现在使用完全相同的 git 存储库创建一个新的 Heroku 应用程序时,添加一个 Postgres 插件(但现在是 13 版)我遇到连接错误:

Error during migration run:
{ error: no pg_hba.conf entry for host "34.252.159.221", user "xx", database "xx", SSL off 

(此处省略了heroku凭据)

我尝试过将sslmode=required 添加到网址等解决方案,但后来我得到Error: self signed certificate

我应该怎么做才能连接到我的 Postgres 13 数据库?

非常感谢!

【问题讨论】:

  • PostgreSQL 日志中对应的条目是什么?

标签: postgresql heroku connection


【解决方案1】:

找到了。它在文档中。 https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js 我猜这是在过去 9 个月中添加的,因为我在以前的项目中不必这样做

在连接配置对象中:

  ssl: config.ENV === 'production' && {
    rejectUnauthorized: false,
  },

【讨论】:

  • 我不记得这是新的。我认为您只是将两个数据库配置不同。
猜你喜欢
  • 1970-01-01
  • 2021-01-24
  • 2018-12-15
  • 2019-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-15
相关资源
最近更新 更多