Cloud SQL from App Engine (flexible environment) connection issue
Asked Answered
C

1

1

I'm trying to access my Cloud SQL instance from my App Engine flexible environment NodeJS application but kept getting timeout issues.

When I add the IP of the compute engine running the App engine to the Cloud SQL Access Control it works. The documentation states that access should be granted automatically if both are in the same project.

What am I missing?

I'm using the following connection settings for knex:

const config = {
    host: 'myIP',
    user: 'user',
    password: 'password',
    database: 'database',
    port: 3306
  };

The socket settings aren't working either. throwing a "Unhandled rejection Error: connect ENOENT /cloudsql" exception:

const config = {
    socketPath: '/cloudsql/project:zone:instance',
    user: 'user',
    password: 'password',
    database: 'database'
  };
Continuous answered 16/8, 2017 at 9:3 Comment(4)
Please describe the connection string you are using to connect. Have you followed cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql?Padrone
I've added my connection settings. The tutorial uses socketPath which doesn't work either. Only thing I was able to get to work was with IP and adding it to authorized networks in cloud sql.Continuous
Did you follow all the steps? In particular did you set cloud_sql_instances in app.yaml?Padrone
Yep you're absolutely right, I skipped the bit with the beta_settings in the app.yaml. Works as expected now. If you want to add this as the answer I can accept it.Continuous
P
3

This error most likely indicates that the proxy process is not running on the GAE Flexible instance.

As per the documentation, you must have cloud_sql_instances set in your app.yaml file for the proxy to be automatically started.

Padrone answered 22/8, 2017 at 4:28 Comment(4)
That didn't help in my case. Any other idea?Tuddor
Have you gone through the linked documentation step by step?Padrone
Yes - I found out that there's a problem with my cli I guess... When deploying from cloud shell it works but not from local.Tuddor
The documentation link is brokenMilly

© 2022 - 2024 — McMap. All rights reserved.