由于权限错误,无法部署 Firebase 云功能

Anu*_*thi 6 firebase firebase-realtime-database google-cloud-functions firebase-cli

我试图使用 firebase cli 部署我的第一个 firebase 云函数,但我遇到了一个错误:

C:\Users\Anurag Tripathi\Desktop\firebasecloudfunction> firebase deploy --only functions

Error: Missing permissions required for functions deploy. You must have permission iam.serviceAccounts.ActAs on service account  project_number@appspot.gserviceaccount.com.

To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL: 
        https://console.cloud.google.com/iam-admin/iam?project=project_number
Run Code Online (Sandbox Code Playgroud)

我试图按照说明解决问题,但没有成功。请帮忙。

Gen*_*ene 11

firebase projects:list
Run Code Online (Sandbox Code Playgroud)

如果当前的 Firebase 帐户没有您的项目,您必须先注销。

firebase logout  
firebase login
firebase projects:list
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

firebase use <project ID>
Run Code Online (Sandbox Code Playgroud)

例如,

firebase use stripesample1


firebase projects:list
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

firebase deploy --only functions
Run Code Online (Sandbox Code Playgroud)


小智 9

根据文档中的指定,除了服务帐户用户角色之外,您还应该将Cloud Functions 管理员角色分配给用于部署函数的服务帐户

  • 我已经给出了project-id@appshot.gserviceaccount.com服务帐户用户角色和云功能管理员角色,但我仍然收到相同的错误。您知道使用哪个服务帐户来部署功能吗 (2认同)

小智 7

这对我有用。首先运行firebase login:list查看登录 firebase cli 的帐户是否与您在 Google Cloud Console 中授权的帐户相同。如果没有,请运行firebase logout <email>then firebase login,然后再次部署。


小智 5

事实证明我在 .firebaserc 文件中的项目名称错误。将名称更改为正确的谷歌云项目名称后,它就起作用了。