curioswitch / sqltools-cloudsql-pg

MIT License
2 stars 3 forks source link

Unable to connect to cloudSQL instance using IAM Authentication #1

Open fredsco opened 6 months ago

fredsco commented 6 months ago

I am unable to connect to my cloudSQL instance using IAM Authentication. Using the db password works fine. The error I am receiving:

ERROR: Error opening connection SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string

Application Default Credentials is configured.

chokoswitch commented 6 months ago

Hi @fredsco - would you be able to share a possibly redacted version of the JSON representation of your config to confirm it? The one I have that uses IAM authentication successfully looks like this

"sqltools.connections": [
            {
                "previewLimit": 50,
                "driver": "CloudSQL-PostgreSQL",
                "name": "mydb",
                "group": "dev",
                "instanceConnectionName": "myproject-dev:us-central1:mydb",
                "database": "mydb",
                "username": "administrator@myproject-dev.iam",
                "impersonatedServiceAccount": "administrator@myproject-dev.iam.gserviceaccount.com",
                "iamAuthentication": true
            }
        ],

Note that if your JSON looks different from that, there could be a UI bug in the editor that allows an incorrect config so would be good to confirm it.