1

I am deploying Django app to Google Flexible Environment using the following command

gcloud app deploy

But I get this error

Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Invalid Cloud SQL name: gcloud beta sql instances describe

What could be the problem?

2 Answers2

1

In your app-yaml file (as well as in mysite/settings.py), you have to provide the instance connection name of your CloudSQL instance. It is in the format:

[PROJECT_NAME]:[REGION_NAME]:[INSTANCE_NAME].

You can get this instance connection name by running the gcloud command gcloud sql instances describe [YOUR_INSTANCE_NAME] and copy the value shown for connectionName. In your case it seems that you have copied the command itself instead of the connectionName value.

Alternatively, you can also get the instance connection name by going to your Developer Console > SQL and click on your instance. You'll find the instance connection name under the "Connect to this instance" section.

LundinCast
  • 9,412
  • 4
  • 36
  • 48
  • Thank you for this it really helped me.I had put a wrong name in app.yaml `beta_settings: cloud_sql_instances:[PROJECT_NAME]:[REGION_NAME]:[INSTANCE_NAME]1` – Calvin Ochieng Mar 27 '18 at 20:23
1

LundinCast post contains the most important information to fix the issue. Take also into account that the Cloud SQL Proxy provides secure access to your Cloud SQL Second Generation instances (as described here). Use this command to run the proxy, if you already created one, as suggested in this Django in App Engine Flexible guide:

./cloud_sql_proxy -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:5432

The mentioned command establishes a connection from your local computer to your Cloud SQL instance for local testing purposes and must be running while testing but it is not required while deploying.

Rubén C.
  • 1,098
  • 6
  • 16