Firebase Functions - You have exceeded your deployment quota

I have asked for help on Firebase Community slack and now I understand what has happened. Thanks, @katowulf.

Quotas are described here: https://firebase.google.com/docs/functions/quotas#quota_limits_for_firebase_cli_deployment

We have 3 quotas related to deployment which are:

  1. API calls (READ) - 1 call per deployment, no matter how many functions
  2. API calls (WRITE) - 1 call per function
  3. Max build time - A few minutes per function depending on size

To see which one you have hit you can go to quotas admin: https://console.cloud.google.com/projectselector2/projectselector/iam-admin/quotas?service=cloudfunctions.googleapis.com&usage=ALL&supportedpurview=project

In my case, I have hit quota 3. Max build time which is limited to 12000 seconds per day (by default). After some experiments, I have noticed that one function deploy adds around ~70 sec to build time (might be a different number in your case!). So 12000/70 gives around 170 functions deploys per day.

On Quotas admin page (second link) you can ask to increase any quota with Edit Quota option. 36000 sec build time is available without any additional approvals which in my case increased individual functions deploys number to 500+ per day.

Quotas Admin

A quota was reset to 0 around 0:00 UTC-07:00 and my functions are deployed to us-central1. So day seems to have a fixed time slot (it is NOT last 24h moving window).

For bigger projects, you should not deploy the whole project all at once, but just individual functions like described in a link https://firebase.google.com/docs/cli/#deploy_specific_functions


Your functions are 70+ so deploying it 5-7 times in a short span will exceed one of the limits mentioned here: https://firebase.google.com/docs/cli/#deployment_quotas

For each function that the Firebase CLI deploys, these types of rate and time limits are affected:

API calls (READ) - 1 call per deployment, no matter how many functions
    Limit: 5000 per 100 seconds
API calls (WRITE) - 1 call per function
    Limit: 80 per 100 seconds
Max build time - A few minutes per function depending on size
    Limit: 120 minutes per day

Here is an example which may relates to your error: https://firebase.google.com/docs/cli/#deployment_quotas

It's possible (though unlikely) that you might exceed a quota that limits the rate or volume of your Firebase deployment operations. For example, when deploying very large numbers of functions, you might receive an HTTP 429 Quota error message. To solve such issues, try using partial deployment or requesting quota increases for specific Firebase services. For example, the quota called Write requests per 100 seconds per user might help to resolve the Cloud Functions 429 error cited above.

What you can do is create a script which will call deploy for each function, if you want to deploy every function. This will make sure that you don't exceed the limits in your production.

In development you know which functions will have changes based on code changes, so you can only deploy modified functions and do your testing.