【问题标题】:Trying to deploy firebase functions, Default service account not found尝试部署 firebase 功能,未找到默认服务帐户
【发布时间】:2020-04-03 10:44:03
【问题描述】:

我正在尝试将以下简单功能上传到我的 firebase 控制台

const functions = require('firebase-functions');

exports.helloWorld = functions.https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

但是,它失败并出现以下错误:

HTTP Error: 400, Default service account 'myfirebase-projecte@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.

此时,我对 Firebase 和 Google Cloud Platforms 以及在哪里可以修复此错误感到困惑。

【问题讨论】:

  • 您是否按照建议操作并禁用/重新启用 Cloud Functions API?您必须在 Google Cloud 控制台中执行此操作。
  • 是的,我有,但无济于事。

标签: node.js firebase authentication firebase-authentication google-cloud-functions


【解决方案1】:

兔子洞你好!我想到了。好像我不小心删除了我的默认服务帐户(幸好在 30 天内),我能够按照这些非常具体且非常有用的说明https://cloud.google.com/iam/docs/creating-managing-service-accounts#undeleting 将其恢复,因为无法使用控制台界面重新激活。

基本上,您必须找到删除发生的时间,从该事件中获取帐户 ID,然后使用 Google Cloud 终端使用gcloud beta iam service-accounts undelete [ACCOUNT_ID] 命令恢复它。呸!

【讨论】:

  • 很高兴你知道了!
  • 对于尝试创建新服务帐户并将其设置为默认值的人,因为他们的 30 天窗口已过,请在此处查看我的答案:stackoverflow.com/questions/57474965/…
【解决方案2】:

Firebase 使用 Google Cloud Platform (GCP) 运行 Cloud Functions。此错误消息告诉您您的 GCP 设置有问题。因此,请尝试错误消息中的内容:转到您已将 Firebase 项目链接到 here 的 Google Cloud 项目,然后关闭并重新打开 Cloud Functions API。如果这不起作用,您可能需要确保您正在部署的 Firebase CLI 已正确登录(运行 firebase login 以检查),并且可以访问该项目——这有时会导致问题。

【讨论】:

  • 我尝试禁用和启用 Cloud Functions APi 以及使用 firebase logooutfirebase login 通过 CLI 注销和重新登录。在firebase deploy 上仍然出现同样的错误。
  • 我访问了 App Engine 服务帐户页面,但无法创建以 @appspot.gserviceaccount.com 结尾的服务帐户。我现在该怎么办?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-24
  • 2019-01-15
  • 2017-11-19
  • 1970-01-01
  • 1970-01-01
  • 2019-07-21
相关资源
最近更新 更多