You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
KMS Bad Key error when using existing Blob context to overwrite object. #502
A Bad Key error can occur when trying to overwrite an existing object when metadata with local metadata.
For example:
// Write an empty object with a kmsKeyName.
Blob blob = storage.create(blobInfo, Storage.BlobTargetOption.kmsKeyName(kmsKeyName))
// Using blob that already has metadata received from Storage API to create a writer.
WriteChannel writer = blob.writer();
// The following will error with the following error:
// {
// "message": "Bad Cloud KMS crypto key: projects/project-id/locations/us/keyRings/lab1/cryptoKeys/annie-test-key/cryptoKeyVersions/1",
// "domain": "global",
// "reason": "invalid"
// }
writer.write(ByteBuffer.wrap(content, 0, content.length));
The recommended change is if kmsKeyName is defined in object metadata is to remove it the resource id contains:
A Bad Key error can occur when trying to overwrite an existing object when metadata with local metadata.
For example:
The recommended change is if kmsKeyName is defined in object metadata is to remove it the resource id contains: