I am trying to connect google cloud sql instance with cloud function written in python.
global pg_pool, pg_pool_db_name
pg_config = {
'user': CONNECTION_DATA[dbname]['DB_USER'],
'password': CONNECTION_DATA[dbname]['DB_PASSWORD'],
'host': host,
'dbname': dbname
}
pg_pool = ThreadedConnectionPool(1, 1, **pg_config)
This function test call failed and it outputs error message:
Error: function terminated. Recommended action: inspect logs for termination reason. Details:could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/cloudsql/my_instance_name/.s.PGSQL.5432"?
Anybody experienced on this kind of situation.