Can't connect to PostgreSQL instance proxied through GCP's Cloud SQL Proxy
- Dominant language
- Python
- Stars
- 485
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
- I'm running a [Cloud SQL Proxy](https://cloud.google.com/sql/docs/postgres/connect-admin-proxy) to connect to my GCP hosted PostgreSQL instance with IAM credentials instead of using the internal user/password authentication system (which is the preferred way when working with GCP)
- Locally I can connect to this instance using `psql "sslmode=disable hostaddr=127.0.0.1 dbname=[dbname] user=[username]"`, explicitly disabling SSL as it is terminated by Cloud SQL Proxy itself
- I'm trying to set up a connection with Postico using the same hostname, database and user
## What did you expect to happen?
- I expected to see an warning that a connection cannot be established using SSL asking me to connect without SSL instead as I've read that Postico switches to `sslmode=prefer` when connecting to local instances
## What actually happened?
- The app hangs on "Negotiating SSL…" and finally gives the following message:
```
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
```
## What seems to be the issue?
- Cloud SQL Proxy does not handle connections that try to use SSL properly it seems, as using `psql` with `sslmode=prefer` hangs in a similar way as Postico
- It would however be resolved quite easiliy by allowing a connection to explicity disable SSL (which a lot of other PostgreSQL clients allow, and therefore work perfectly fine with this setup)
## What software versions are you using?
Postico version: 1.5.17
macOS version: 10.15.7
PostgreSQL version: PostgreSQL 13.2 on x86_64-pc-linux-gnu
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the connection using Cloud SQL Proxy and the reported psql command, comparing SSL-disabled behavior with sslmode=prefer. Trace Postico's PostgreSQL connection and SSL negotiation flow; done means a proxied PostgreSQL connection can explicitly disable SSL without hanging or terminating unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, postgresql, python
- Domain
- databases, desktop, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100