codelab-friendlychat-web icon indicating copy to clipboard operation
codelab-friendlychat-web copied to clipboard

Deploy Error: Insufficient permissions to configure a trigger (permission denied for bucket)

Open JohnEMSammons opened this issue 9 years ago • 10 comments

When I add the blurOffensiveImages code, and deploy I get the following error:

! functions[blurOffensiveImages]: Deploy Error: Insufficient permissions to (re)configure a trigger (permission denied for bucket friendlychat-XXXXXXXXXX.com). Please, give owner permissions to the editor role of the bucket and try again.

I removed the full url.

I followed the tutorial correctly as far as I can tell.

My current storage rules are as follows:

// Grants a user access to a node matching their user ID service firebase.storage { match /b/{bucket}/o { // Files look like: "user//path/to/file.txt" match /user/{userId}/{allPaths=**} { allow read, write: if request.auth.uid == userId; } } }

Did I miss something?

Thanks,

John

JohnEMSammons avatar Mar 24 '17 00:03 JohnEMSammons

Hi @JohnEMSammons do you have multiple users adding images? Having allow read, write: if request.auth.uid == userId; would mean that only the user that posted the image could see it.

kroikie avatar Mar 25 '17 21:03 kroikie

Can I ask how you created your Firebase project? Did you simply create the project normally through the Firebase app console? Is it an older project? (we had bugs at some point where Cloud Storage buckets were not created wit the right permissions but that should be fixed)

Basically it seems you may have hit a bug. Try re-creating a new firebase project and let us know if that should fix this issue...

nicolasgarnier avatar Mar 30 '17 14:03 nicolasgarnier

This was integrated into an existing Firebase project. The project was originally created a few months ago. I will move to a new Firebase project and see how it goes. What is the procedure for correcting existing firebase projects with permissions issues?

JohnEMSammons avatar Mar 30 '17 16:03 JohnEMSammons

I started a new project and now I can deploy. the function is still not working however. What should my storage rules be?

I am currently getting the following in my blurOffensiveImages log:

3:20:05.407 PM outlined_flag blurOffensiveImages Function execution took 44 ms, finished with status: 'ok' 3:20:05.404 PM info blurOffensiveImages This is not a user folder. 3:20:05.364 PM outlined_flag blurOffensiveImages Function execution started

when I change the rules permission to user level, then nothing is able to post to the bucket, and I get the spin icon forever.

I went through all of the code labs to confirm the details, and I believe I have followed all of the steps. Thanks,

John

JohnEMSammons avatar Mar 30 '17 19:03 JohnEMSammons

I just had the same problem. I looked at a new project permissions and noticed that in the old project there were some missing.

To fix it try these steps:

  1. Go to: https://console.cloud.google.com/storage/browser?project=your-firebase-project-id
  2. Click on the three dots near the default bucket (not the one starting with "staging"), then click on "Edit bucket permissions" You will find an item "Project owners-xxxxxxxxxx Owner"
  3. Copy the number "xxxxxxxxxx" and add these items: "Project viewers-xxxxxxxxxx Reader" "Project editors-xxxxxxxxxx Owner"

UPDATE (April 14, 2017)

I just found that in order to use GCS API to upload/move/delete files there are other permissions to add:

  • click on "Edit object default permissions"
  • add : "Project owners-xxxxxxxxxx Reader" "Project viewers-xxxxxxxxxx Reader" "Project editors-xxxxxxxxxx Owner"

Only newly uploaded files will get the new permissions, the older ones will have to be set up manually.

dogeweb avatar Apr 01 '17 11:04 dogeweb

👍 Thanks for the Help @DogeWeb that's exactly it.

nicolasgarnier avatar Apr 03 '17 12:04 nicolasgarnier

👍 That was the issue with my old project. Thanks DogeWeb!

JohnEMSammons avatar Apr 03 '17 20:04 JohnEMSammons

Thanks @DogeWeb for the update. I needed to update "object default permissions" in addition to the "bucket permissions" as well. All is working now.

Eliyar avatar Apr 25 '17 20:04 Eliyar

I had this problem ("Insufficient permissions to configure a trigger") -- but the solution turned out to be something different entirely. The Google user I'm logged in as has access to multiple Google Cloud projects. I had to set the project= flag on the deploy command to get this to work!! Took hours of tearing my hair out to work it out.

mikeknapp avatar May 19 '17 22:05 mikeknapp

thanks @mikeknapp , adding "--project=" worked for me!

priyeshgpatel avatar Aug 28 '17 18:08 priyeshgpatel