最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PostgreSQL authentication method 10 not supported - Rails - Stack Overflow

programmeradmin0浏览0评论

So, we have this old API which uses Rails 5.0.3, Ruby Version is 2.3; That is hosted on AWS ECS, and the DB used is a Postgres V12 on an Aurora/RDS. The issue is that since Postgres V12 is not being supported anymore ( we can still use it there but noww it will be way more expensive since it is deprecated), we need to migrate that API to Postgres 17 but when we tried to point the API to this new DB host with that upgraded Postgres Version, when doing the deploy task on ECS we could see the error "PostgreSQL authentication method 10 not supported". Other API's of ours would connect to the old Postgres 12 and to this new 17 one without an issue.

From this answer and other that I found, it seems clear that the issue is on the "Postgres Client Software" which is outdated and has to support the scram-sha-256 authentication method. What is this Postgres Client Software in a Rails App? I though it would be the pg gem which we were using the 0.21 version, but even after trying to update to v1.2.3 (which is being used to the other API's who had no issue connecting to the Postgres 17 RDS server) it didn't work, and we saw the same authentication error being displayed.

What actually should I update on that rails app so I can get rid of that error when connecting to that PG 17 server?

So, we have this old API which uses Rails 5.0.3, Ruby Version is 2.3; That is hosted on AWS ECS, and the DB used is a Postgres V12 on an Aurora/RDS. The issue is that since Postgres V12 is not being supported anymore ( we can still use it there but noww it will be way more expensive since it is deprecated), we need to migrate that API to Postgres 17 but when we tried to point the API to this new DB host with that upgraded Postgres Version, when doing the deploy task on ECS we could see the error "PostgreSQL authentication method 10 not supported". Other API's of ours would connect to the old Postgres 12 and to this new 17 one without an issue.

From this answer and other that I found, it seems clear that the issue is on the "Postgres Client Software" which is outdated and has to support the scram-sha-256 authentication method. What is this Postgres Client Software in a Rails App? I though it would be the pg gem which we were using the 0.21 version, but even after trying to update to v1.2.3 (which is being used to the other API's who had no issue connecting to the Postgres 17 RDS server) it didn't work, and we saw the same authentication error being displayed.

What actually should I update on that rails app so I can get rid of that error when connecting to that PG 17 server?

Share Improve this question asked Mar 16 at 15:22 Roger PeixotoRoger Peixoto 3782 gold badges5 silver badges18 bronze badges 7
  • 1) Postgres 12 supported scram-sha-256 per Password auth. 2) What version of libpq are you using on the client that the API is being run from? 3) What is the deploy task doing? – Adrian Klaver Commented Mar 16 at 16:06
  • @AdrianKlaver how do I find the libpq version? About the deploy task, it just do the usual to set the cluster name and the image name – Roger Peixoto Commented Mar 16 at 16:36
  • 2 Findinglibpq version is going to depend on the OS and packaging. For instance here on Ubuntu 22.04: apt-cache search libpq finds libpq5 - PostgreSQL C client library and apt info libpq5 finds Version: 17.4-1.pgdg22.04+2. – Adrian Klaver Commented Mar 16 at 16:54
  • Also "PostgreSQL authentication method 10 not supported" should not be triggered until some client tries to connect. What is the client in the deploy task that is trying to connect? – Adrian Klaver Commented Mar 16 at 17:05
  • 1 Yeah scram-sha-256 was introduced in Postgres 10, any of the 9.x versions would be out of date. Note, for Postgres versions less then 10 the x in X.x.y is a major version and y is the minor release. In 10+ the format is X.y. – Adrian Klaver Commented Mar 16 at 19:53
 |  Show 2 more comments

1 Answer 1

Reset to default 2

As discussed in other answers, scram-sha-256 was introduced in PostgreSQL 10 so you need at least libpq v10. v17 would be best so you can take advantage of all of PostgreSQL v17's features.

And if you're going to upgrade Ruby, upgrade to the latest bugfix within that minor version. Instead of 2.7.1 upgrade to 2.7.8.

发布评论

评论列表(0)

  1. 暂无评论