维护后显示密码身份验证的HEROKU数据库失败

发布于 2025-01-30 14:49:50 字数 654 浏览 3 评论 0原文

因此,我收到了Heroku的一条消息,说它需要在我的数据库上进行维护,并且只会阅读一点。但是,我去检查我的网站,并且该站点不适用于需要数据库中数据的页面,我去检查日志并查看此错误消息:

2022-05-20T09:57:55.246102+00:00 app[web.1]: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "eu-west-1.compute.amazonaws.com" (52.18.116.67), port 5432 failed: FATAL:  password authentication failed for user "MYUSERNAME"
2022-05-20T09:57:55.246102+00:00 app[web.1]: connection to server at ".eu-west-1.compute.amazonaws.com" (52.18.116.67), port 5432 failed: FATAL:  no pg_hba.conf entry for host "IP", user "MYUSERNAME", database "DATABASE", no encryption

我没有触摸或更改任何内容,所以不确定什么是什么问题是。

So i received a message from heroku saying it needs to carry out maintenance on my database and will be read only for a bit. However I go to check my site and the site isn't working for the pages that require data from the database, I go to check the logs and see this error message:

2022-05-20T09:57:55.246102+00:00 app[web.1]: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "eu-west-1.compute.amazonaws.com" (52.18.116.67), port 5432 failed: FATAL:  password authentication failed for user "MYUSERNAME"
2022-05-20T09:57:55.246102+00:00 app[web.1]: connection to server at ".eu-west-1.compute.amazonaws.com" (52.18.116.67), port 5432 failed: FATAL:  no pg_hba.conf entry for host "IP", user "MYUSERNAME", database "DATABASE", no encryption

I haven't touched or changed anything, so not sure what the problem is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨敛清荷 2025-02-06 14:49:50

如果您不使用Heroku管理的“动态”环境变量连接到PostgreSQL数据库,则会发生这种情况

,最好使用Database_url,因为它始终具有最新的位置,并且凭证

Heroku可以更改URL url url由于各种原因,

如果您使用的是SQLalchemy,则凭证轮换可能需要轻微 oraroard

os.environ.get('DATABASE_URL').replace('postgres://', 'postgresql://')

This happen if you are not using the "dynamic" environment variable that Heroku manage for connecting to a PostgreSQL database

If you have just one, it's better to use DATABASE_URL as it always have up-to-date location and credentials

Heroku can change the url for various reasons, ex credentials rotation

If you are using sqlalchemy you might need a slight workaround:

os.environ.get('DATABASE_URL').replace('postgres://', 'postgresql://')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文