firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 926 forks source link

Cloud Billing API check when deploying Functions with Google Workload Identity #7584

Open bkendall opened 3 weeks ago

bkendall commented 3 weeks ago

[REQUIRED] Environment info

firebase-tools: v13.15.4

Platform: macOS

[REQUIRED] Test case

I'm fairly certain this will work with any function deployed with a workload identity. For example, I have a GH action with the following block (for authentication):

      - id: auth
        name: Authenticate to GCP
        uses: google-github-actions/auth@v2
        with:
          create_credentials_file: true
          workload_identity_provider: projects/xxxx/locations/global/workloadIdentityPools/github-action-pool/providers/github-action-provider
          service_account: github-action@yyyy.iam.gserviceaccount.com

[REQUIRED] Steps to reproduce

Deploy using the workload identity provider as above - probably easiest to do in GH actions once you have it set up. Instructions are in the action from Google

[REQUIRED] Expected behavior

Successful deploy.

[REQUIRED] Actual behavior

The CLI is giving me an error that the Cloud Billing API isn't enabled:

Error: HTTP Error: 403, Cloud Billing API has not been used in project 194637951628 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudbilling.googleapis.com/overview?project=194637951628 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

I assume, btw, that this API is enabled in the CLI's 'producer project', which is why this check succeeds when I run a deploy locally. I'm not sure what's causing this billing check, but it would be nice to either (1) skip it or (2) enable it, if it really needs to be enabled.

cc: @ifielker and @taeold who dealt with a similar problem recently :)

steveoh commented 2 weeks ago

This is also affecting me and my projects in github actions ubuntu runner.

bkendall commented 23 hours ago

I'm not sure why, but this check is no longer being made - maybe it was a change in firebase-functions? This might be able to be closed now.