1
votes

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'
  };
1
Please describe the connection string you are using to connect. Have you followed cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql?Vadim
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.jimmy
Did you follow all the steps? In particular did you set cloud_sql_instances in app.yaml?Vadim
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.jimmy

1 Answers

3
votes

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.