Repository navigation
fix(functions): build with the custom service account when the default compute account is missing or disabled - #11618
Open
IzaakGough wants to merge 19 commits into
Open
IzaakGough wants to merge 19 commits into
IzaakGough wants to merge 19 commits into
Conversation
# Conflicts: # src/gcp/cloudfunctionsv2.spec.ts
…fault one is unusable Setting buildConfig.serviceAccount on every deploy broke runtime service accounts without build permissions. The build service account is now only set when the default compute service account is missing or disabled, and uses projects/- so accounts from other projects resolve.
# Conflicts: # CHANGELOG.md # src/deploy/functions/release/fabricator.ts
# Conflicts: # CHANGELOG.md
Fail before deploying when a v2 function would build as a missing or disabled default compute account, and print the commands to grant the build role to the functions' own accounts instead of granting it.
# Conflicts: # CHANGELOG.md
…e security accounts
# Conflicts: # CHANGELOG.md
…-sa' into @invertase/fns-custom-sa # Conflicts: # src/deploy/functions/checkIam.spec.ts # src/deploy/functions/checkIam.ts # src/deploy/functions/prepare.ts
IAM grants take up to a few minutes to apply, and Cloud Build fails immediately when the managed account can't yet read the source bucket. Wait before creating or updating functions that build as a managed account that was just created or given roles.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for building v2 Cloud Functions using their runtime service accounts when the default compute service account is missing or disabled. Feedback on the changes suggests wrapping the default compute service account lookup in a try-catch block to prevent unexpected deployment failures if the API call itself fails. Additionally, it is recommended to explicitly set the build service account to null when not overridden to avoid configuration drift and ensure previous custom build service accounts are cleared.
IzaakGough
marked this pull request as ready for review
December 1, 2026 13:41
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8841. Supersedes #9598, keeping the original commits from @HassanBahati and @cabljac. Stacked on #11534, which it shares the default account lookup with.
2nd gen deploys failed when the default compute service account was deleted or disabled, even if every function set its own
serviceAccount.Now each function builds as its own account, and the deploy prints the
gcloudcommand to grant it the Cloud Build builder role.requiresRolesuggestion instead, since the CLI creates them during the deploy.Tested with unit tests and live deploys with the default account healthy, disabled and deleted, including a first declarative security deploy. Event functions not tested live.