gcloudgoogle-cloud-rungoogle-cloud-sdk

gcloud run jobs deploy is crashing w/ can only concatenate str (not "tuple") to str?


I started getting this error today when running gcloud to do source deployment to Cloud Run:

This command is equivalent to running gcloud builds submit --tag [IMAGE] . and gcloud run jobs deploy surfey-bin --image [IMAGE]

Building using Dockerfile and deploying container to Cloud Run job [surfey-bin] in project [surfey] region [us-central1] X Building and updating job... Building Container.
OK Uploading sources...
OK Building Container... Logs are available at [https://console.cloud.google.com/cloud-build/builds/b650028c-ac14-4c3b-b5b8-f2e06a2ebdd5?project=270402655279].
Job failed to deploy
ERROR: gcloud crashed (TypeError): can only concatenate str (not "tuple") to str

If you would like to report this issue, please run the following command: gcloud feedback

To check gcloud for common problems, please run the following command: gcloud info --run-diagnostics

Here's the full command I'm running:

gcloud run jobs deploy "surfey-bin" \
  --cpu 4 \
  --memory 8Gi \
  --max-retries 2 \
  --project surfey \
  --region us-central1 \
  --set-env-vars "OPENAI_ORGANIZATION=$OPENAI_ORGANIZATION" \
  --set-secrets=OPENAI_API_KEY=OPENAI_API_KEY:latest \
  --source . \
  --task-timeout 1200

Here's the gcloud version dump from my local machine:

$ gcloud --version
Google Cloud SDK 474.0.0
alpha 2024.04.26
beta 2024.04.26
bq 2.1.4
bundled-python3-unix 3.11.8
core 2024.04.26
gcloud-crc32c 1.0.0
gke-gcloud-auth-plugin 0.5.8
gsutil 5.27
kubectl 1.26.15
minikube 1.32.0
skaffold 2.11.1

I also get the same thing with this command running on Google Cloud Shell and the gcloud info --run-diagnostics reports no issues.

The build actually succeeds and generates a new image in the artifact registry that is properly tagged with latest. However, it doesn't actually switch the image used by the Cloud Run Jobs entry and due to my cleanup rules that image gets removed and then Cloud Run Jobs begin failing with "image not found".

Finally, if I lookup the built image from the artifact registry and then run gcloud run jobs deploy surfey-bin --image ... it works!?


Solution

  • I was facing the same issue.

    I downgraded to version 472 and it worked.

    gcloud components update --version 472.0.0
    

    Seems a bug in their latest(474 as of now) version