Upload error when using the v1.3.0 of the GCS client
Problem
I tried to upgrade the GCS client module to the latest version (v1.6.0 at the time of writing) but was unable to.
After upgrading to the latest version all uploads fail with the following error:
gcs: googleapi: Error 400: Uploads must be sent to the upload URL. Re-send this request to https://storage.googleapis.com/upload/storage/v1/b/201963/o?alt=json&prettyPrint=false&projection=full&uploadType=multipart, wrongUrlForUpload"
Looking at the storage client changelog, we can see that in v1.3.0 the storage.googleapis.com/storage/v1
endpoint is now used by default for GCS requests instead of www.googleapis.com/storage/v1
. This change breaks the registry.
Solution
I thought this would be an easy fix, as I found the www.googleapis.com
host hardcoded in registry/storage/driver/gcs/gcs.go, but it turns out that this method is not invoked for uploads.
I wasn't able to find any other places were the old endpoint is hardcoded, so this requires further investigation.