Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on google function deploy, service account doesn't exist

Please can you help me, I'm receiving this error when I'm trying to deploy a google cloud function:

HTTP Error: 400, Default service account '[email protected]' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.

The command used to deploy is:

firebase deploy --only functions

A temporary solution is fine, but if you can help me to solve it permanently is better.

Thanks in advance.

like image 362
Zarape Soft Avatar asked Feb 27 '19 18:02

Zarape Soft


People also ask

What service account does cloud function use?

At runtime, Cloud Functions defaults to using the App Engine default service account ( [email protected] ), which has the Editor role on the project. You can change the roles of this service account to limit or extend the permissions for your running functions.

Why does cloud deployment fail?

Cloud Functions deployment can fail if the entry point to your code, that is, the exported function name, is not specified correctly. Your source code must contain an entry point function that has been correctly specified in your deployment, either via Cloud console or Cloud SDK.


1 Answers

I was struggling to resolve this issue, then I raised a case with Google.

here is a detailed article of my learnings : https://medium.com/@ashirazee/http-error-400-default-service-account-appspot-gserviceaccount-com-accd178ea32a

Firstly navigate to Google Cloud Platform and view your service accounts.

try and find <project_id>@appspot.gserviceaccount.com' in your list of service accounts for the firebase project, it is linked to the App Engine.

if '@appspot.gserviceaccount.com' is missing you can not deploy anything(SEE EMAIL WITH GOOGLE BELOW), if it isn't, check and see if it's enabled, try disabling it and enabling it again.

@appspot.gserviceaccount.com is pre-installed by default, regardless of a paid account or not. try and recall if at any time you may have deleted it after or before deployment.

Now if you have for any reason deleted it over a period of more than 30 days than you can not retrieve it, and you must create a new firebase project. However, if it is within 30 days you can undelete it.

EMAIL FROM GOOGLE:

Email #1 " Hello Ali

I am checking the logs of your project, unfortunately the service account was deleted on Ma, there is no chance to recover it nor recreate it

The only workaround available is to create a new project and deploy the service desired there. I know this could not be the best option for you nevertheless it is the way this works by design.

Do not hesitate to write back if you have more questions.

Cheers,"

Email #2,

"Hello Ali

I am glad to read that you have been able to deploy your functions successfully, unfortunately that service account cannot be recovered after 30 days of being deleted and that is the only solution. If you have other questions, please let us know by contacting us again through our support channel.

Cheers,"


lastly here is a helpful command line that will help you debug this, however, it won't help if there is no service account, it'll just highlight the obvious:

firebase deploy --only functions --debug

this was my error:

"HTTP Error: 400, Default service account '<project_id>@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Clo ud Functions API), or specify a different account."

like image 85
Ali Shirazee Avatar answered Sep 25 '22 06:09

Ali Shirazee