Search code examples
postgresqlpsqlpg-promise

Error no pg_hba.conf entry for host when using PG client, but not when connecting with psql?


I'm pointing my application from one PG cluster to another (changing the team that manages the PG cluster), and I'm getting connection errors when trying to connect with a language binding for javascript:

no pg_hba.conf entry for host xxx.x.x.x, user "blah", database "blah", SSL off

I'm led to believe that this is a pg_hba.conf configuration error, but I can connect to the cluster with psql, from the same machine, with the same credentials.

  • psql: 9.5.7,
  • PG cluster 10.5
  • Client: pg-promise 9.3.3

How can this be possible? Is this still definitely an issue with how pg_hba.conf is set up or is there something wrong with how I configured my client? This is not the first time I've used it, I've been connecting to a PG cluster v. 9.5.7 for the last couple of years.


Solution

  • The issue was that the new cluster is using SSL for the connection. When I connected to the old cluster, there was no SSL, so the connection worked with my current config, but when switching to the new cluster I had to specify that SSL was being used.

    https://github.com/vitaly-t/pg-promise/wiki/Connection-Syntax