简体   繁体   中英

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM