Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API returned: Cannot use ACL API to set object policy when object policies are disabled. #111

Closed
MarkEdmondson1234 opened this issue Nov 14, 2019 · 8 comments

Comments

@MarkEdmondson1234
Copy link
Collaborator

MarkEdmondson1234 commented Nov 14, 2019

Now buckets can be set with uniform ACL, the gcs_upload fails as it tries to set them. Probably solved by having the option to remove that ACL from the request.

@remibacha
Copy link

Hello Mark,
I still have the message "Error : API returned: Cannot use ACL API to set object policy when object policies are disabled." when using the gcs_upload().
Do you have any update this?
Thank you for your help

@MarkEdmondson1234
Copy link
Collaborator Author

At the moment the fix is to not set ACL bucket wide permissions for the bucket, but leave it the old per-object access control.

I think the fix will be to remove ACL data in the API request for those types of buckets.

@MarkEdmondson1234
Copy link
Collaborator Author

From https://cloud.google.com/storage/docs/json_api/v1/objects/insert

If iamConfiguration.uniformBucketLevelAccess.enabled is set to true, requests that include this parameter fail with a 400 Bad Request response.

So I think just remove the Acl field, and it will be fixed

@MarkEdmondson1234
Copy link
Collaborator Author

MarkEdmondson1234 commented Dec 30, 2019

I added a potential fix, could you test it? @remibacha

Install dev version: remotes::install_github("cloudyr/googleCloudStorageR")

Use predefinedAcl = "bucketLevel" in your upload function.

MarkEdmondson1234 added a commit that referenced this issue Jan 1, 2020
MarkEdmondson1234 added a commit that referenced this issue Jan 1, 2020
@MarkEdmondson1234
Copy link
Collaborator Author

gcs_upload(mtcars, bucket = "mark-bucketlevel-acl",
                   predefinedAcl = "bucketLevel")

MarkEdmondson1234 added a commit that referenced this issue Jan 1, 2020
@remibacha
Copy link

Everything seems OK now! Good job Mark

@Pit-Storm
Copy link

@MarkEdmondson1234 Thanks for the Hotfix. But i Think you missed the gcs_copy_object() function. There should also be a parametervalue "bucketLevel". I tried it with the latest github commit, but it didn't work. and it says

Request Status Code: 400
Error: API returned: Invalid string value: 'bucketLevel'. Allowed values: [authenticatedread, bucketownerfullcontrol, bucketownerread, private, projectprivate, publicread]

As long as the update isn't available in CRAN. Can you please post a snippet which removes the ACLs from the call to get this work?

@MarkEdmondson1234
Copy link
Collaborator Author

Continued on #132 (comment)

@cloudyr cloudyr locked as resolved and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants