2

I'm setting up Firebase's new Preview Channels (very excited for). I have set up their standard Deploy to Preview Channel workflow, and it does deploy and post the comment! However, when I click the link and try to log into my site, I get the following error:

{"error":{"code":403,"message":"Requests from referer https://myProject--pr673-mybranch-2fgs8acb.web.app/ are blocked.","errors":[{"message":"Requests from referer https://myProject--pr673-mybranch-2fgs8acb.web.app/ are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}

The workflow is:

name: Deploy to Preview Channel

on:
  pull_request:

jobs:
  build_and_preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: npm ci
      - name: Generate Build
        run: npm run build-dev
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          expires: 30d
          projectId: myProject
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

This type of behavior is typically expected because:

I am limiting access to my project to only my trusted domain

enter image description here

But, this is causing the issue with Preview Channels because my site is restricted to my domain (and the Preview Channels aren't my domain).

I have thought of a couple of ways to solve this but am not sure if either is actually possible:

  1. To still restrict my project to my domain AND programmatically grant access to any of my preview channels as the workflow runs.
  2. –OR– Set up the Preview Channel workflow to somehow deploy to a sub-domain of mine and grant access to all wildcard sub-domains (Although based on the screenshot above, it doesn't seem possible to grant access to wildcards or paths)

Is there a way I can use Preview Channels while still projecting my project?

(either via #1, #2, or any other approach to resolve this issue without removing the restriction to my domain)

Rbar
  • 3,740
  • 9
  • 39
  • 69
  • did you solve the issue? I am also facing a similar issue – AndroidEngineX Jan 09 '21 at 09:23
  • @AtulGupta unfortunately not really. The only workaround I currently have is: (1) set up a second project that is not protected, (2) in the build settings, select the second environment when deploying for the Preview Channel, and then (3) test on the second project – Rbar Jan 11 '21 at 19:34

0 Answers0