firebase / firebase/firebase-tools

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

Open
#10,507 7 comments 0 reactions 0 assignees View on GitHub
api: functions reproducible type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [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
```js
import { setGlobalOptions } from 'firebase-functions/v2'
import { onSchedule } from 'firebase-functions/scheduler'
setGlobalOptions({
serviceAccount: '',
})

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.