“HTTP Error: 400, Default service account: appspot.gserviceaccount.com (Email’s from Google’s support team included)

A Shirazee
3 min readAug 6, 2020

When deploying firebase cloud functions are you getting the following 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 Cloud Functions API), or specify a different account.”

Or are you unable to see the functions on your dashboard after deployment?

Here is a more simplified response: Stack Overflow

This article should offer some clarity.

I was recently struggling with this issue and eventually solved it after raising the matter with Google’s support teams (Google’s response below).

My apollo express graphql server was working fine locally but whenever I tried to deploy it using firebase cloud functions it would print an error.

So here are my learnings and how this issue was ultimately resolved.

How to debug this error

It is important to note that @appspot.gserviceaccount.com is the App Engine default service account. It acts as a security feature “ intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.”

To get an idea of where things are going wrong use this command line.

firebase deploy - -only functions - -debug

If ‘@appspot.gserviceaccount.com’ is missing, then you won't be able to deploy anything(SEE EMAILS 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 for any reason you deleted the service account 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.

Here is my conversation with Google’s support team, they were extremely helpful.

RESPONSE FROM GOOGLE’S Support team Email #1:

“ Hello Ali

I am checking the logs of your project, unfortunately the service account was deleted on May, 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,”

RESPONSE FROM GOOGLE’S Support team 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, the command line:

firebase deploy — -only functions — -debug

Is helpful, Although it won’t help if there is no service account linked to the App Engine, it’ll just highlight the obvious:

This was the error that was only resolvable by creating a new project.

“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 Cloud Functions API), or specify a different account.”

I hope this helps.

--

--