'Error with Postgres Database Authentication with Data Studio

I am trying to connect my postgres database to Data Studio and I received the following error:

Sorry, we encountered an error and were unable to complete your request. Error ID:1b7b6c50.

I entered in the same credentials that I used (successfully) when I connected my postgres database to Tableau, and I can't seem to figure out what the issue is.

 Host Name or IP: localhost
 Port: 5432
 Database: WU
 Username: postgres
 Password: [my correct password]

While troubleshooting, I also tried entering in 1 ::1 and :1 for the host name, and got the same error. However, when I entered local as the host name, it seemed like Data Studio did some thinking before shooting me a different error. The new error said:

Can't reach the host. Please double check your connection parameters. Learn more about database connectors here.
Error ID: 079b22f8"

Does anyone have an explanation as to what is going wrong here?



Solution 1:[1]

You need to whitelist some ips inorder for google data studio to connect to postgres. Here's the google support

Solution 2:[2]

I spent hours on this - I think there is something wrong with adding authorised networks IP addresses for your instance in google console. I named each address ds1, ds2 etc. and had to add them one by one. Adding all 12 then clicking 'save' didn't seem to save them.

Even when I had them all listed in console, it would not authenticate.

As a last gasp attempt I tried a v12 instance (was on v14) but made no difference.

Finally I ran the IP updates as a gcloud command:

gcloud sql instances patch [instance] --authorized-networks=64.18.0.0/20,64.233.160.0/19,66.102.0.0/20,66.249.80.0/20,72.14.192.0/18,74.125.0.0/16,108.177.8.0/21,173.194.0.0/16,207.126.144.0/20,209.85.128.0/17,216.58.192.0/19,216.239.32.0/19

This then let me in but only on the v12 instance, not the v14.

In summary, stick to v12 and run a gcloud command above.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 iCurious
Solution 2 Andronicus