FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
695 stars 202 forks source link

[BUG] preview hosts are not being added to the authorized domains list #347

Open rosostolato opened 6 months ago

rosostolato commented 6 months ago

I always used this action to deploy preview links for my PRs. But, recently, the google authenticator stopped working for my app because the preview domain isn't being added to the "authorized domains" list anymore.

I don't know if this is Firebase or this action plugin fault.

Action config

- uses: FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: "${{ secrets.GITHUB_TOKEN }}"
    firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
    expires: 30d
    projectId: my-awesome-project

Error message

No errors. It deploys successfully.

Expected behavior

Expected to have the new preview URL domain added to the firebase authorized domains.

Actual behavior

The preview link is created, posted to the PR comments but the domain is not added to the authorized domains, causing google auth to not work on the preview link.

weilinzung commented 6 months ago

It seems something on Google's side, but hard to tell from this action extension.

https://stackoverflow.com/a/64468339/8543478 from this, possible to catch the error?

Firebase tool source code: https://github.com/firebase/firebase-tools/blob/06220c3b9912099eefbaa6e0a4dfd46d2e58aa2a/src/commands/hosting-channel-deploy.ts#L200-L224

skynetigor commented 6 months ago

We also have this issue last couple of days. As a workaround, we manually add preview domains to authorized domains in Firebase console.

michaelk-kipnis commented 6 months ago

Any news regarding this issue? We are clueless and need assistance..

weilinzung commented 6 months ago

Someone created the issue over firebase tool already: https://github.com/firebase/firebase-tools/issues/6828

We are using "firebase-tools": "12.8.1"` in our NX repo but the action is trying to install the latest version as default.

  npm WARN exec The following package was not found and will be installed: firebase-tools@13.4.0

As a workaround, we set the Firebase tool version to 12.8.1 that has no this issue for our case: https://github.com/FirebaseExtended/action-hosting-deploy/pull/246

https://github.com/FirebaseExtended/action-hosting-deploy?tab=readme-ov-file#firebasetoolsversion-string

firebaseToolsVersion {string} The version of firebase-tools to use. If not specified, defaults to latest.



jobs:
  build_and_preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Add any build steps here. For example:
      # - run: npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: xxx
          firebaseServiceAccount: xxx
          projectId: xxx
          firebaseToolsVersion: v12.8.1 => here
schankam commented 6 months ago

Same issue here.

I checked the service account used and it has the correct Firebase Authentication Admin permission. When I run the command locally on my machine, it work as expected and add the preview channel domain to the list of authorised domains.

It just does not work in the CI, how can we unlock this situation? We're blocked cause preview channel are basically useless if we can't login on them.

rosostolato commented 6 months ago

@schankam this solutions worked for me https://github.com/firebase/firebase-tools/issues/6828#issuecomment-1976707086