Reputation: 183
Trying to upload an image from server to server I got:
[ { domain: 'global', reason: 'forbidden', message: 'googlec-storage-object-creator@project-name.iam.gserviceaccount.com does not have storage.objects.delete access to bucket-mybucket/mypicture.jpg.' } ], code: 403,
If the image name is different, it just works. Versioning is suspended, and there was a file with that name, but it was removed.
I even removed the bucket and created it again, and the problem persists.
No error at all if the filename is different from "mypicture.jpg"
Any help about that ? Thanks
Upvotes: 3
Views: 2005
Reputation: 4291
I did the same thing as OP did,and had spending a bunch of hours for this, I found out the post from google cloud node on github.
By stephenplusplus
I have a feeling this is due to an issue in gcs-resumable-upload, the module behind this method. There is a PR with a fix: stephenplusplus/gcs-resumable-upload#23
In the meantime, you could try:
Disabling resumable uploads: gcs_file.createWriteStream({ resumable: false }) Deleting the cache file that gcs-resumable-upload uses to track the state of uploads: ~/.config/configstore/gcs-resumable-upload.json If neither of these work, we likely have a different problem on our hands. Let me know, and sorry you ran into this!
Just disabling resumable update on WriteableStream, and enjoy the new world.
Upvotes: 8
Reputation: 8178
If I understood your question correctly, you are trying to upload a file mypicture.jpg
to one of your buckets bucket-mybucket
, using a service account with which you have storage.objectCreator role permissions.
The error message that is shown makes me understand that there was already a file mypicture.jpg
, and you are trying to override it, which requires the storage.objects.delete permission, which is not granted in the role I presume you are using.
There are several points that can be covered:
mypicture.jpg
) and it failed too?gsutil ls -L gs://BUCKET_NAME/FILE_NAME
to see its
metadata and check whether there is any remaining thing from that
file that may be conflicting and requires the delete
permission.gsutil ls -a gs://BUCKET_NAME
.gsutil
CLI tool, Client Library...?Upvotes: 2