41

I am trying the following firebase deploy command and I get the following error:

Error: Authorization failed. This account is missing the following required permissions on project ID project:

  cloudfunctions.functions.create
  cloudfunctions.functions.delete
  cloudfunctions.functions.get
  cloudfunctions.functions.list
  cloudfunctions.functions.update
  cloudfunctions.operations.get
  firebase.projects.get
  firebasehosting.sites.update

I have all the accesses. I am working with angular 6.

I should mention that this project was working normal in a previous project in Firebase. I have created a new one and I want to migrate the contents of the previous one to this new one and there the problem started.

I should also mention that before I was logged in with another user.

Any ideas?

Paco Zevallos
  • 2,165
  • 7
  • 30
  • 68

8 Answers8

46

If you created your project in the fireabse website account, during firebase deployment we need to select that firebase project for hosting. Also if you created more than one project in the firebase account, we need to select one project for the deployment process. For that you need to run the below command.

firebase use --add

It will list multiple project and you can choose one from that option. Then run firebase deploy.

Roshil K
  • 2,583
  • 28
  • 38
25

Follow the next steps :

firebase projects:list

Result :

┌──────┬───────────────────────┬─────────────┐
│ Name │ Project ID / Instance │ Permissions │
├──────┼───────────────────────┼─────────────┤
│ itest │ chrome-epigram-510    │ O       │
└──────┴───────────────────────┴─────────────┘

Use command :

firebase use chrome-epigram-510

Result : Now using project chrome-epigram-510

Use command

firebase deploy

Result
=== Deploying to 'chrome-epigram-510'...

i  deploying hosting                                                                     
i  hosting[chrome-epigram-510]: beginning deploy...                                      
i  hosting[chrome-epigram-510]: found 9 files in dist/icrm                               
+  hosting[chrome-epigram-510]: file upload complete                                     
i  hosting[chrome-epigram-510]: finalizing version...                                    
+  hosting[chrome-epigram-510]: version finalized                                        
i  hosting[chrome-epigram-510]: releasing new version...                                 
+  hosting[chrome-epigram-510]: release complete                                         
                                                                                         
+  Deploy complete!    

                                                             

Hosting URL: https://chrome-epigram-510.firebaseapp.com

yN.
  • 1,847
  • 5
  • 30
  • 47
Jaouad halli
  • 251
  • 3
  • 3
23

I was also facing same issue but I logged out and then logeed in again its working fine now

to logout in command line firebase logout to login again type firebase login

niranjan pb
  • 1,125
  • 11
  • 14
7

I had this issue because I created and used an alias with firebase use --add then manually removed it from the .firebaserc. The solution was to run firebase use $alias where $alias is the alias of your project. EG: firebase use default

Andy
  • 6,869
  • 2
  • 31
  • 24
3

in my case I was getting the following:

> firebase deploy


Error: Authorization failed. This account is missing the following required permissions on project deploy:

  firebase.projects.get
  firebasehosting.sites.update
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! n00001@0.0.0 deploy: `firebase deploy`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the n00001@0.0.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/beeeep/.npm/_logs/2099-98-95T09_97_94_392Z-debug.log

Looks like this was the reason: I had deployed it once, then removed the .firebaserc file before pushing it to github. Then tried again to deploy.

Resolved it by doing a firebase use --add and selecting the desired firebase project. Which created the .firebaserc file again. Guess the error message is misleading here.

Anand Rockzz
  • 6,072
  • 5
  • 64
  • 71
3

For me, this was due to having multiple sites. I changed the project name rather than the site name and therefor didn't have permissions.

Your .firebaserc file points to the "project" within Firebase.

{
  "projects": {
    "default": "my-project"
  }
}

While the firebase.json file points to the "site" within Firebase.

{
  "hosting": {
    "site": "my-site"
  }
}
doublejosh
  • 5,548
  • 4
  • 39
  • 45
0

This happened to me several times, but it was always because I was either

  • logged in to my employer's firebase account, trying to deploy a personal app
  • logged into my personal firebase account, trying to deploy a company app.
0

Try this

firebase login --reauth

Working with multiple projects, it's common for the firebase CLI to be logged in with an account where the project doesn't belong and reauthenticating will ensure the correct account and also fix expired/invalid logins.

Abraham
  • 12,140
  • 4
  • 56
  • 92
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Tyler2P Nov 06 '22 at 10:11