Skip to content

fix(functions): skip Eventarc roles for a deleted default compute service account - #11534

Open
IzaakGough wants to merge 10 commits into
mainfrom
fix/skip-deleted-default-compute-sa
Open

IzaakGough wants to merge 10 commits into
mainfrom
fix/skip-deleted-default-compute-sa

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #10536

Fixes #10507.

Deploying 2nd gen event functions failed when the project's default compute service account had been deleted, even if every function set its own serviceAccount.

If that account is missing or disabled and no v2 event function runs as it, the deploy now skips its role grants and prints the gcloud commands to grant those roles to the functions' own accounts.

Tested with unit tests and a live deploy with the default account deleted. The disabled case has unit tests only. A full deploy there still needs #9598.

…vice account

When the default compute service account no longer exists and every v2 event function sets its own service account, skip granting it roles and print the gcloud commands for the functions' accounts instead.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces logic to handle scenarios where the default compute service account is missing during function deployment. It adds a new helper function, obtainEventarcServiceAccountBindings, to src/deploy/functions/checkIam.ts and updates ensureServiceAgentRoles to incorporate this check, along with comprehensive unit tests in src/deploy/functions/checkIam.spec.ts. The reviewer identified an issue where IAM member strings were missing the required serviceAccount: prefix and provided a code suggestion to resolve it.

Comment thread src/deploy/functions/checkIam.ts Resolved
…es warning

Declarative security accounts get these roles at release, so printing commands for them is noise.
A function that names the deleted default account now gets the early error instead of grant commands for an account that does not exist. The error no longer suggests Node-only syntax.
… guidance

requiredRoles only grants the roles the user declares, so managed accounts need run.invoker and eventarc.eventReceiver too when the default compute account is deleted.
These accounts are created during release and only get the roles their codebase declares, so printed gcloud commands fail on a first deploy. Skip the suggestion when both roles are already declared.
@IzaakGough
IzaakGough marked this pull request as ready for review November 17, 2026 16:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

functions/v2/setGlobalOptions serviceAccount option cannot change the firebase-tools IAM checker default behavior

1 participant