I'm very new to Google Cloud and running applications in general. I currently have a Django app running in a Docker container on Google Flexible App Engine that connects to a Google Cloud SQL (PostgreSQL) instance in the same project. The latest version has been running for about 3 days now without issue.
The Problem:
Today I started receiving OperationalError: server closed the connection unexpectedly
errors repeatedly from the application.
I can run the Cloud SQL Proxy and it starts up normally (Ready for new connections
), but if I try to connect with psql, I receive the error:
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
And the proxy reports:
couldn't connect to "<instance_name>:us-central1:<instance_name>":
dial tcp <ip address>:3307: connect: connection refused
On SSHing into my running flex app instance and running sudo docker logs <cloud proxy container>
, the last lines are, similarly:
couldn't connect to "<instance_name>:us-central1:<instance_name>":
dial tcp <ip address>:3307: getsockopt: connection refused
Things I've Tried/Checked
- Restarted cloud sql instance. The instance itself is running fine and I can access it using cloud shell from the console.
- Checked db instance name and ip address - they match.
- Restarted the flex app engine instance. No change as far as I can tell.
- Upgraded my local copy of cloud_sql_proxy to 1.09.
- Checked quotas - I don't seem to have hit any API or simultaneous connection limits.
- I'm able to connect to the sql instance by authorizing my local IP address.
- I'm able to connect to a different (but very similar) Google Cloud SQL instance using the proxy locally so I'm not sure if the proxy is at fault.
Any help at all would be appreciated, at this point I'm out of ideas. Thank you!