Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following the example with github.com/jackc/pgx/v5 doesn't work #3545

Open
sanbor opened this issue Oct 26, 2023 · 0 comments
Open

Following the example with github.com/jackc/pgx/v5 doesn't work #3545

sanbor opened this issue Oct 26, 2023 · 0 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. stale: old Pull request is old and needs attention. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@sanbor
Copy link

sanbor commented Oct 26, 2023

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

The issue you're having must be related to a file in this repository. We are unable to provide assistance for issues unrelated to samples in this repository.

Please include as much information as possible:

In which file did you encounter the issue?

https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/cloudsql/postgres/database-sql/connect_connector_iam_authn.go

Did you change the file? If so, how?

Use github.com/jackc/pgx/v4 instead of github.com/jackc/pgx/v5 and github.com/jackc/pgx/v4/stdlib instead of github.com/jackc/pgx/v5/stdlib.

Set usePrivate to true.

Describe the issue

Following the mentioned code sample, I would get the error

failed to connect to `host=/tmp user=<redacted>-sa@<redacted>.iam database=<redacted>-postgres`: failed to receive message (remote error: tls: protocol version not supported)",

After trial and error, I followed https://pkg.go.dev/cloud.google.com/go/cloudsqlconn#section-documentation and out of curiosity tried github.com/jackc/pgx/v4 instead of github.com/jackc/pgx/v5 and the IAM connection started to work.

It seems something doesn't work with github.com/jackc/pgx/v5 and private IP. I suggest you revert #3306 to avoid other people running into this issue. Or even better, make it work with private IP and github.com/jackc/pgx/v5.

Have a nice day!

@sanbor sanbor added priority: p2 Moderately-important priority. Fix may not be included in next release. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 26, 2023
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Oct 26, 2023
@subfuzion subfuzion added the stale: old Pull request is old and needs attention. label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. stale: old Pull request is old and needs attention. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants
@sanbor @subfuzion and others