How do you use gcs signed URL to do multipart upload?

Using GCS, I want to generate a link on the server and pass it to the clients. The clients use it to upload a large file, hence the multi part upload.

I'm able to initiate the multipart upload which gives me the uploadId (ref: https://cloud.google.com/storage/docs/xml-api/post-object-multipart). But when I try to upload the parts using the signed url which I used to make the POST request on, or generate new signed urls for each part with PUT, I get a 403 with `SignatureDoesNotMatch` code with reason `The request signature we calculated does not match the signature you provided. Check your Google secret and signing method.`

The service account used here at "sa json" should have all the permissions because it is added as a storage admin to the project itself.

Here's the python code I'm using. (gist: https://gist.github.com/PrashantRaj18198/3a86f3dede38d828367193e6236e94b3)

Any help would be appreciated. I'm not sure about the issue because I'm not using my own signing program, I'm likely missing something.

 
0 1 108
1 REPLY 1

Hello @prashant_wb,

Welcome to the Google Cloud Community!

I discovered a discussion on GitHub involving users encountering the same issue and error as you.

As mentioned in the discussion, the browser needs to set the matching Content Type in the request headers.

If a content-type is provided, the client (browser) must include this HTTP header, set to the same value, as required. For more details, refer here.

Removing the content type while creating the signed URL should resolve the issue in the browser.

Additionally, another user suggested generating a new key, as the existing key had expired.