Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JohnEMSammons opened this issue Mar 24, 2017 · 10 comments
Assignees

Comments

@JohnEMSammons
Copy link

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

@kroikie
Copy link
Contributor

kroikie commented Mar 25, 2017

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.

@nicolasgarnier
Copy link
Contributor

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

@JohnEMSammons
Copy link
Author

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
Copy link
Author

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

@dogeweb
Copy link

dogeweb commented Apr 1, 2017

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.

@nicolasgarnier nicolasgarnier changed the title firebase-cloud-functions/#8 Deploy Error: Insufficient permissions to configure a trigger (permission denied for bucket) Apr 3, 2017
@nicolasgarnier
Copy link
Contributor

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

@JohnEMSammons
Copy link
Author

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

@Eliyar
Copy link

Eliyar commented Apr 25, 2017

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

@mikeknapp
Copy link

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.

@priyeshgpatel
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants