gpt4 book ai didi

postgresql - Heroku Postgres : "psql: FATAL: no pg_hba.conf entry for host"

转载 作者:行者123 更新时间:2023-12-03 18:14:15 25 4
gpt4 key购买 nike

有许多 Heroku CLI Postgres 命令都返回相同的错误。例如:

$ heroku pg:bloat
psql: FATAL: no pg_hba.conf entry for host "...", user "...", database "...", SSL off

这些命令中至少有一个在过去有效,但现在无效。

否则数据库似乎工作正常。我可以通过我的应用程序的界面访问它。

我看不到在 Heroku Postgres 仪表板中切换 SSL 的方法。可能是什么原因造成的,我该如何解决?

最佳答案

连接到 时出现错误Postgres 从外部应用程序。修复与您使用的语言有关。在 java 您需要链接 ?sslmode=require查询字符串,在 NodeJS (我的情况)你应该添加rejectUnauthorized: false如下 -

const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
});
引用 https://devcenter.heroku.com/articles/heroku-postgresql更多细节。

Enjoy!

关于postgresql - Heroku Postgres : "psql: FATAL: no pg_hba.conf entry for host",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60048669/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com