Reputation: 1860
I am running the following command using the gcloud cli tool...
gcloud sql instances create sql-db-1 --database-version=MYSQL_8_0 --region=us-central --tier=db-f1-micro
It sits in the terminal for a long time with the following output...
Creating new cloud sql instance...
and then finally fails with...
ERROR: (gcloud.sql.instances.create) Operation https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/operations/0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8 is taking longer than expected. You can continue waiting for the operation by running `gcloud beta sql operations wait --project my-project 0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8`
Status : FAIL 1 b''
This same command was working for me reliably, and then all of a sudden it just started doing this.
Upvotes: 2
Views: 1152
Reputation: 509
When you execute the command line, it creates the Cloud SQL instance, but the CLI throws an ERROR making you think that this wasn’t created; so I opened an issue tracker report for you.
Meanwhile you can also run after the error:
gcloud beta sql operations wait --project my-project xxxxxxxxxxxxxxxxxxxxxx
And wait for the operation to complete. After that, you must see STATUS as DONE:
NAME TYPE START END ERROR STATUS
XXXXXXXXXXXXXXXXXXXXXXXXX CREATE 2022-03-09T21:53:40.532+00:00 2022-03-09T22:06:53.389+00:00 - DONE
When you open this link in the ERROR:
https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/operations/0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8
You will get:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"service": "sqladmin.googleapis.com",
"method": "google.cloud.sql.v1beta4.SqlOperationsService.Get"
}
}
]
}
}
Upvotes: 1
Reputation: 1816
You'll need to run the Cloud SQL Auth Proxy locally to mimic what Cloud Run does for.
gcloud auth login
)./cloud_sql_proxy -instances=my-project:my-region:my-instance -dir ./cloudsql
Then the Proxy will create a Unix socket at ./cloudsql/my-project:my-region:my-instance
.
Note: to make this most like Cloud Run, you can always create a /cloudsql
directory at the root.
Upvotes: 0