Skip to content

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

@samuel-pp

Description

@samuel-pp

[REQUIRED] Environment info

firebase-tools: v13.20.0

Platform: macOS

[REQUIRED] Test case

Any newly created or existing Firebase project

[REQUIRED] Steps to reproduce

Create a project and delete the default compute service account (my compute service account was mistakenly deleted and more than 30 days have passed), create a new service account.
Use the following code

import { setGlobalOptions } from 'firebase-functions/v2'
import { onSchedule } from 'firebase-functions/scheduler'
setGlobalOptions({
    serviceAccount: '<your new service account>',
})

exports.testSchedule = onSchedule('every day 00:00', async () => {
    console.log('hello')
})

Then deploy the function with firebase-tools. It will show the error below

Image

[REQUIRED] Expected behavior

Don't throw Error from ensureServiceAgentRoles() in src/deploy/functions/prepare.ts and just list the role for every service account (Let user set these roles manually)
Or get the service account in the setGlobalOptions. if cannot get the config, support a way to override the default compute service account (The gcloud alpha CLI requires applying for alpha permissions, which is not very convenient)

[REQUIRED] Actual behavior

cannot deploy a new service

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions