Trying to deploy firebase functions, Default service account not found

送分小仙女□ 提交于 2020-06-28 06:52:05

问题


I am trying to upload the following simple function to my firebase console

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

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

However, it fails with the following error:

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.

At this point I am confused between Firebase and Google Cloud Platforms and where this error can be fixed.


回答1:


Firebase uses Google Cloud Platform (GCP) to run Cloud Functions. This error message is telling you that something's wrong with your GCP setup. So, try what the error message says: go to the Google Cloud project you've linked your Firebase project to here, and turn the Cloud Functions API off and back on. If that doesn't work, you might want to make sure the Firebase CLI you're deploying from is logged in correctly (run firebase login to check), and has access to the project -- that can sometimes cause issues.




回答2:


Hello from the rabbit hole! I figured it out. Seems like I accidentally deleted my Default Service Account (thankfully within 30 days) and I was able to recover it by following these very specific and very useful instructions https://cloud.google.com/iam/docs/creating-managing-service-accounts#undeleting since it's not possible to re-activate using the console's interface.

Basically, you have to find when the deletion occured, get the account's ID from this event and then restore it using the Google Cloud terminal with the gcloud beta iam service-accounts undelete [ACCOUNT_ID] command. Phew!



来源:https://stackoverflow.com/questions/60983987/trying-to-deploy-firebase-functions-default-service-account-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!