English 中文(简体)
新创建的消防基地的功能 Error
原标题:Newly Created Firebase Functions Throwing UNAUTHENTICATED Error
  • 时间:2020-04-11 02:08:38
  •  标签:
  • firebase

我有一个消防基地项目,有10多个云层功能。 今天,我又增加了3个,但所有3个新机构都在犯错误,没有实际试图打断这一职务。 (在记录中没有职能记录。) 我没有改动我的环境或防火基地项目,因为增加了以前的职能。

我已尝试在我的项目中重新调配所有职能,其中三个新职能继续失败,而前三个职能则进行罚款。 我还证实,我正在使用第8号,因为使用第10号令,据报存在一些类似的问题。 我不敢肯定,因为这个问题只适用于新的职能。

新职能都有类似的签字:

exports.createGroup = functions.https.onCall((data, context) => {
  //Firestore access
});

他们也这样说:

const create = functions().httpsCallable( createGroup );
return create({ group: oGroup }).then(result => {
      //Do something
}).catch(err => {
      console.log(err.message); //UNAUTHENTICATED
});

不适用:8.16.2

消防工具版本:7.6.1

最佳回答

谷歌 docs:

As of January 15, 2020, HTTP functions require authentication by default. You can specify whether a function allows unauthenticated invocation at or after deployment.

解决办法是利用谷歌云星座(NOT 消防基地星群)添加新设立的功能的<代码>allUs许可。

https://cloud.google.com/Functions/docs/securing/managing-access-iam#allowing_unauthenticed__inue

问题回答

2024 UPDATE

  1. Open the Cloud Functions page in the Google Cloud Console: https://console.cloud.google.com/functions/list.
  2. Click the checkbox next to the function to which you want to grant access.
  3. Click Permissions at the top of the screen. The Permissions panel opens.
  4. Click Add principal.
  5. In the New principals field, type allUsers.
  6. Select the role Cloud Functions > Cloud Functions Invoker from the Select a role drop-down menu.
  7. Click Save.

必须在

  1. Go to your GCP Console and login
  2. On the top menu, select the corresponding Firebase project
  3. On the left menu go to Cloud Functions Click the checkbox of your function (not the name of the function)
  4. Once selected, on the right menu select "Add member"
  5. On "New member" type allUsers
  6. On the Select function bar, select Cloud Functions -> Cloud functions invoker
  7. Click on "Save" and then "Allow public access" on the pop-up warning And you re good to go!

我在部署若干职能时就犯了这一错误,在上载期间,似乎部署工作腐败了

拆除了火库ole中的 offending云功能,然后为它们进行新的成功部署, 防火基功能

First I tried to just redeploy the functions, but that was not enough, the error continued this way

2nd genumi Functions:

  1. Go to the Google Cloud console
  2. Click the linked name of the function to which you want to grant access.
  3. Click the Powered By Cloud Run link in the top right corner of the Function details overview page.
  4. Click Trigger and select Allow unauthenticated invocations.
  5. Click Save.

在试图增加所有用户和获得“类型用户和所有经了解的用户”后,我永远找不到这一点。

Not sure if this did the trick but it seemed to work. I had the allUsers permission set in Google Cloud Console for my function with the Role "Cloud Functions Invoker" set by default, but it was not working - UNAUTHENTICATED error.

我评论了我在当地部署的新职能,并询问我是否希望从西里德那斯解放阵线删除。

Then uncommented the function and deployed again. (I tried deleting from Firebase too but that didnt work.)

接着,我回过谷歌云康索尔(Function details -> Permissions)并编辑了allUsers 许可,并增加了额外作用(“ Functions Admin)。 见下文。

enter image description here

测试并奏效。

Then I deleted the "Cloud Functions Admin" Role (for safety) and just left the "Cloud Functions Invoker" Role. Now it works. Dont know why this happened, hopefully doesnt happen again...

如果你使用< Functions Gen2,该功能建立在 > ......上,你必须指定援引人(roles/run.invoker)

  1. Goto Cloud run,
  2. Check the box next to your function,
  3. Click the button "PERMISSION",
  4. In the side bar, click on "ADD PRINCIPAL"
  5. write "allUsers" and give them "cloud run invoker" permission.
Note: If you want to achieve the equivalent of assigning the Cloud Functions  admin  or  developer  role to a 1st gen function, you need to assign Cloud Functions  admin  or  developer  to the 2nd gen function and assign  Cloud Run invoker  to the Cloud Run service.
$
gcloud functions add-invoker-policy-binding api 
      --region="asia-southeast1" 
      --member="MEMBER_NAME"




相关问题
• 如何关闭卢布特弗雷的分部?

我设立了一个新的账户,以便能够更好地管理我在消防基地的项目,但我已开始使用一个不同的账户来开会,我如何能够在......时结束这一账户的欺骗。

How to write to second tree in Firebase Realtime Database

I have a Firebase Realtime Database and I want to write to it, that s simple enough, but I have added more than one tree to my Database and want to know how to write to the second tree. Right now I ...