Closed djMax closed 1 year ago
I have a feeling this is a mismatch in the user account on the db where it's missing the domain name. SO I think the bug MIGHT be just that the error is really really useless.
@djMax, you are not passing clientOpts
when creating the Pool
.
Hi @djMax, I believe the issue is as @edosrecki mentioned, it seems you are not passing the clientOpts
to the call to new Pool()
.
Can you try updating your code to the following:
const pool = new Pool({
...clientOpts,
user: 'test-sa@test-project.iam',
database: 'db-name',
max: 5
});
Let me know if the change solves the problem, this snippet was taken from our README
Sorry - that was a bad cut paste as I was trying to remove extraneous detail. It was being passed. BUT, the problem is the service account that terraform had mapped in the "bad case" was wrong - it was missing the @test-project.iam
bit. But for whatever reason, it wasn't saying "login failed for that SA" it was saying this other weird thing, and then timing out on the SQL side.
This issue is really good to find, we just encountered the same thing on our project. It would save on a lot of confusion if the error mentioned that the iam user failed first, before falling back on user/password connection
Bug Description
I have two apps that are almost exactly the same (same infra, same package versions, same db config code). They are connecting to two different CloudSQL Postgres instances but same PG versions and configurations as far as I can tell in GCP console.
pg-pool is 3.6.1 pg is 8.11.3 cloud-sql-nodejs-connector is 0.5.1
The connection code is:
I've verified db and user are correct in both cases. On the client side, I immediately get this error:
In CloudSQL logs I see this after the process ends:
Any ideas? I did cross-coding and verified that trying to connect to the "bad" db with the "good" code also fails. So I'm suspecting something is wrong the the CloudSQL db but I don't know what.