temp_
temp_

Reputation: 1317

Cloud Functions for Firebase Storage Error

I am using Cloud Functions for Firebase and have had success uploading files to storage. But today I am getting this error

Caller does not have storage.objects.create access to bucket.

Does this have something to do with my storage rules I have set up?

Upvotes: 0

Views: 387

Answers (1)

Mike McDonald
Mike McDonald

Reputation: 15963

It's possible that the ACLs for your buckets aren't set up properly. We're working on ways to automagically fix them if we notice they're wrong, but it may take a little to roll that out.

In the mean time, install the latest Cloud SDK: https://cloud.google.com/sdk/docs/ and run these in your favorite terminal:

gsutil defacl ch -p viewers-<PROJECT-ID>:R gs://<BUCKET-ID>
gsutil defacl ch -p editors-<PROJECT-ID>:O gs://<BUCKET-ID>
gsutil defacl ch -p owners-<PROJECT-ID>:O gs://<BUCKET-ID>
gsutil -m acl -r ch -p owners-<PROJECT-ID>:O gs://<BUCKET-ID>
gsutil -m acl -r ch -p viewers-<PROJECT-ID>:R gs://<BUCKET-ID>
gsutil -m acl -r ch -p editors-<PROJECT-ID>:O gs://<BUCKET-ID>

It's likely you'll only need to run the top three to set the default ACLs, rather than the per object ACLs (as per the bottom three).

Upvotes: 2

Related Questions