firebase / firebase/firebase-tools

Github action - Hosting Deploy - 403 error

Open
#5,262 6 comments 0 reactions 1 assignee Claimed by @bkendall View on GitHub
Needs: Attention 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:** 11.16.0

**Platform:** macOS

### [REQUIRED] Test case

Setting up a new project with Hosting using defaults provided by Firebase Tools is not able to deploy via the Github action.

I am able to deploy hosting locally using `firebase deploy --only hosting` without issue.

### [REQUIRED] Steps to reproduce

1. Set up Firebase Hosting using `firebase init hosting`
2. Select `y` for the option to automatically configure Github actions
3. Merge change and push to Github

### [REQUIRED] Expected behavior

The Github action is able to deploy hosting changes

### [REQUIRED] Actual behavior

Something seems missing in the permissions setup. Running the action logs the following

```
=== Deploying to ''...

i deploying hosting
[2022-11-20T06:28:30.000Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites//versions [none]
[2022-11-20T06:28:30.000Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites//versions ***"status":"CREATED","labels":***"deployment-tool":"cli-firebase--action-hosting-deploy"***
[2022-11-20T06:28:30.087Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites//versions 403
[2022-11-20T06:28:30.087Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites//versions ***"error":***"code":403,"message":"Firebase Hosting API has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firebasehosting.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","status":"PERMISSION_DENIED","details":[***"@type":"type.googleapis.com/google.rpc.Help","links":[***"description":"Google developers console API activation","url":"https://console.developers.google.com/apis/api/firebasehosting.googleapis.com/overview?project="***]***,***"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"SERVICE_DISABLED","domain":"googleapis.com","metadata":***"service":"firebasehosting.googleapis.com","consumer":"projects/"***]***

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

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.