ThouCheese / cloud-storage-rs

A crate for uploading files to Google cloud storage, and for generating download urls.
MIT License
124 stars 87 forks source link

Object create and create_streamed always return an Error::Other on a non–200 response #102

Open db48x opened 2 years ago

db48x commented 2 years ago

The documentation implies that errors from Google become an Error::Google, but https://docs.rs/cloud-storage/latest/src/cloud_storage/client/object.rs.html#126 always creates an Error::Other.

Other("{\n  \"error\": {\n    \"code\": 403,\n    \"message\": \"backups@example.iam.gserviceaccount.com does not have storage.objects.delete access to the Google Cloud Storage object.\",\n    \"errors\": [\n      {\n        \"message\": \"backups@example.iam.gserviceaccount.com does not have storage.objects.delete access to the Google Cloud Storage object.\",\n        \"domain\": \"global\",\n        \"reason\": \"forbidden\"\n      }\n    ]\n  }\n}\n")
t4t5u0 commented 2 years ago

@db48x Probably, this is not library error. You can try to grant permission to browse bucket for service account.

db48x commented 2 years ago

Sure, the error went away once I fixed the permissions, but that’s not what I am reporting. I am reporting that the type of the error appears to be wrong.