You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
permissions error when deploying multiple functions at the same time with firebase deploy #11576
Deploy 9 new instances of firestore-bigquery-export function kit using firebase deploy --only functions
[REQUIRED] Expected behavior
firebase deploy --only functions should deploy all functions without failing
[REQUIRED] Actual behavior
it fails with error :
Error: Cannot enable declarative security because you do not have permissions necessary to create the service account. Please ask an IAM administrator to perform the next deploy.
If i deploy functions individually, I don't have any error and permissions are correctly created.
The error message is extremely misleading
Each instance used a different collection, dataset and table, with the Firestore (default) database and functions in us-central1. All other parameters were left at the kit defaults.
Deployed all 9 at once, from an account with the Owner role on the project:
firebase deploy --only functions
The CLI created a managed service account for each instance one after another, granted it roles, and then created all 36 functions. The deploy finished without the declarative security error.
To help me with reproducing this issue would you be able to share the following:
The output of firebase deploy --only functions --debug from a failing run (please remove anything sensitive first)
The account you deploy with (your user account or a service account) and its IAM roles on the project
Your kit configuration: the functions section of firebase.json and the parameter values for one instance (without any secrets)
Hi @pldelattre, thanks for the extra detail. We think the message is misleading. The permissions check before the deploy is the same for one instance or nine, so your account is probably fine.
Each kit instance deploys as its own codebase, and each codebase gets its own managed service account. The CLI creates those accounts one after another without a retry. If creating an account fails for any reason (for example a rate limit or the project's service account quota), the CLI shows the same Cannot enable declarative security because you do not have permissions... error. The cause is in grantNewRoles in src/deploy/functions/release/fabricator.ts.
To confirm, could you share:
The firebase deploy --only functions --debug output from a failing run. The most useful part is the error logged right after Creating managed service account firebase-fn-..., because it contains the real status code and message.
The number of service accounts in the project:
gcloud iam service-accounts list --project YOUR_PROJECT_ID --format="value(email)" | wc -l
In the meantime, we'll look at changing the CLI to show the real error instead of the permissions message.
I have redeployed to a brand new gcp project and run firebase deploy --only functions --debug
I was able to reproduce the error. And we can see a quota error (too many service accounts created per minute) in the logs :
[2026-11-23T17:21:53.195Z] FirebaseError: Request to https://iam.googleapis.com/v1/projects/PROJECT_NAME_REDACTED/serviceAccounts had HTTP Error: 429, A quota has been reached for project number PROJECT_NUMBER_REDACTED: Service accounts created per minute per project.
at responseToError (/Users/myuser/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:53:12)
at RetryOperation._fn (/Users/myuser/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:415:77)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
Error: Cannot enable declarative security because you do not have permissions necessary to create the service account. Please ask an IAM administrator to perform the next deploy.
Hi @pldelattre, thank you for testing this on a new project and sharing the log. That confirms the cause.
The CLI creates one managed service account per kit instance, one after another and without a retry. On your project one of the creations hit the "Service accounts created per minute per project" quota, and the CLI reported that 429 as a permissions error. I'll look into a change to retry when this quota is hit and to show the real error instead of the permissions message.
Until then, deploying a few instances at a time and waiting a minute between deploys should avoid the quota.
Activity
IzaakGough commentedon Nov 23, 2026
Hi @pldelattre, thanks for raising this!
I tried to reproduce this on firebase-tools 15.37.0 (macOS) but wasn't able to. Here is what I did:
Installed the kit:
Configured 9 new instances of it in
firebase.json, each with its own config directory:Each instance used a different collection, dataset and table, with the Firestore
(default)database and functions inus-central1. All other parameters were left at the kit defaults.Deployed all 9 at once, from an account with the Owner role on the project:
The CLI created a managed service account for each instance one after another, granted it roles, and then created all 36 functions. The deploy finished without the declarative security error.
To help me with reproducing this issue would you be able to share the following:
firebase deploy --only functions --debugfrom a failing run (please remove anything sensitive first)functionssection offirebase.jsonand the parameter values for one instance (without any secrets)cabljac commentedon Nov 23, 2026
Hi @pldelattre, thanks for the extra detail. We think the message is misleading. The permissions check before the deploy is the same for one instance or nine, so your account is probably fine.
Each kit instance deploys as its own codebase, and each codebase gets its own managed service account. The CLI creates those accounts one after another without a retry. If creating an account fails for any reason (for example a rate limit or the project's service account quota), the CLI shows the same
Cannot enable declarative security because you do not have permissions...error. The cause is ingrantNewRolesinsrc/deploy/functions/release/fabricator.ts.To confirm, could you share:
The
firebase deploy --only functions --debugoutput from a failing run. The most useful part is the error logged right afterCreating managed service account firebase-fn-..., because it contains the real status code and message.The number of service accounts in the project:
gcloud iam service-accounts list --project YOUR_PROJECT_ID --format="value(email)" | wc -l
In the meantime, we'll look at changing the CLI to show the real error instead of the permissions message.
pldelattre commentedon Nov 23, 2026
Hi @cabljac @IzaakGough,
I have redeployed to a brand new gcp project and run
firebase deploy --only functions --debugI was able to reproduce the error. And we can see a quota error (too many service accounts created per minute) in the logs :
IzaakGough commentedon Nov 23, 2026
Hi @pldelattre, thank you for testing this on a new project and sharing the log. That confirms the cause.
The CLI creates one managed service account per kit instance, one after another and without a retry. On your project one of the creations hit the "Service accounts created per minute per project" quota, and the CLI reported that 429 as a permissions error. I'll look into a change to retry when this quota is hit and to show the real error instead of the permissions message.
Until then, deploying a few instances at a time and waiting a minute between deploys should avoid the quota.
pldelattre commentedon Nov 24, 2026
Thanks for this quick fix @IzaakGough
That looks perfect.