carrierwaveuploader / carrierwave

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
https://github.com/carrierwaveuploader/carrierwave
8.78k stars 1.66k forks source link

Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. #2634

Closed sgrverma24 closed 10 months ago

sgrverma24 commented 2 years ago

Hi all,

Uploading file to google cloud bucket was working fine when we had "Fine-grained" access. Later it is changed to "uniform bucket-level access". Now upload operations are failing with the below error.

invalid: 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 (Google::Apis::ClientError)

Any solutions/suggestions to tackle this issue.

Using 'carrierwave': '1.3.2'

lguida-nasdaq commented 1 year ago

Any news on this? I have been searching how to handle this error as the security team is pushing us to use Uniform bucket-level access.

Looks like the fog-google gem has an option for it: https://github.com/fog/fog-google/blob/c0b13cee73b0493acf76f4c442aeeba85028d8a4/lib/fog/storage/google_json/models/file.rb#L120

lguida-nasdaq commented 1 year ago

So, after digging a little more, I came up with this solution:

CarrierWave.configure do |config|
  # other configs
  config.fog_attributes = { uniform: true }
end