dan
dan

Reputation: 6314

Uploading files to google cloud storage bucket using googleCloudStorageR's gcs_upload for uniform bucket-level access

Probably a usage or settings issue:

I'm trying to use R's googleCloudStorageR package to upload files to my google storage bucket.

Running:

googleCloudStorageR::gcs_upload("test/my_test.csv")

prints these messages:

2020-05-11 18:57:19 -- File size detected as 368 bytes
2020-05-11 18:57:20> Request Status Code: 400

And then this error:

Error: API returned: Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access.

Is there a different usage to googleCloudStorageR::gcs_upload that will succeed? (not clear from its documentation

If I set predefinedAcl to "default" I get a JSON related error:

Error : lexical error: invalid char in json text

This error message is followed by some html code and following that this message:

> xdg-open: unexpected argument 'minimum-scale=1,'
Try 'xdg-open --help' for more information.`.

I'm not sure what JSON it's referring to but if it's the JSON I set googleCloudStorageR to authenticate access to my bucket than I'm surprised it's complaining at this stage

Upvotes: 2

Views: 2499

Answers (2)

dan
dan

Reputation: 6314

The issue has been resolved by the googleCloudStorageR developers. It is not yet on the CRAN distribution but it installing it from github (devtools::install_github("cloudyr/googleCloudStorageR")) should do.

And the usage is:

googleCloudStorageR::gcs_upload("test/my_test.csv", predefinedAcl = "bucketLevel")

Upvotes: 1

Andy Shinn
Andy Shinn

Reputation: 28503

It looks like in https://github.com/cloudyr/googleCloudStorageR/pull/84 it got support to inherit the bucket level ACL if you set predefinedAcl to default. In your example this would be:

googleCloudStorageR::gcs_upload("test/my_test.csv", predefinedAcl = "default")

Upvotes: 1

Related Questions