access denied error when deploying to hosting

2,368 views
Skip to first unread message

Will Holcomb

unread,
Sep 30, 2019, 2:00:14 AM9/30/19
to Firebase Google Group
I created an alias for my site in the Hosting tab:

Screenshot from 2019-09-28 19-58-22.png

I was able to deploy to it for a bit, but something's changed & I can't anymore.

When I run firebase use --add, the only project listed is tracker-fecd2. I edited .firebaserc to be:

{
  "projects": {
    "default": "htrack"
  },
  "targets": {
    "tracker-fecd2": {
      "hosting": {
        "tracker": [
          "tracker-fecd2"
        ]
      }
    },
    "htrack": {
      "hosting": {
        "tracker": [
          "htrack"
        ]
      }
    }
  }
}


When I try firebase deploy, I get:

Error: Authorization failed. This account is missing the following required permissions on project htrack:

  firebase.projects.get
  firebasehosting.sites.update


What am I doing wrong?

W

Alex Memering

unread,
Oct 8, 2019, 2:23:53 PM10/8/19
to fireba...@googlegroups.com
I'm pretty sure that this is because you're specifying the Hosting Site name where the `.firebaserc` file is expecting the Firebase Project name.  So you're probably attempting to access a Firebase Project that you aren't on, thus getting the permission error.

I believe that the structure of that file should be:
```
{
  "projects": {
    "firebase-use-alias": "firebase-project-id",
    ...
  },
  "targets": {
    "firebase-project-id": {
        "product": { // Probably Hosting
          "target-name": [
            "hosting-site-name"
          ],
          ...
        },
        ...
    },
    ...
  }
}
```

What are you trying to do overall?

Alex Memering | Software Engineer | meme...@google.com 


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAB8ffCApLDyZ-VOiWKL9-gVL7qCkZFJUz%3Dv7sLmsJSw5%2BPWj-w%40mail.gmail.com.

William James Holcomb

unread,
Oct 8, 2019, 7:58:44 PM10/8/19
to Firebase Google Group
I tried adding an alias, but it will still only deploy to tracker-fec2.

I am trying to update htrack.web.app which is an additional site on my Tracker project.

-Will

Alex Memering

unread,
Oct 9, 2019, 8:46:52 PM10/9/19
to fireba...@googlegroups.com
If you have multiple Sites on the same project then you probably should be using a "target" field in your `firebase.json` file, this docs page goes into more detail.  If you are trying to deploy the same content to two different Sites (such as one Site being a staging environment and the other being your production environment) we really recommend that you use two different Projects instead.  Mainly this is because you probably want to have completely separate DBs and other storage mechanisms as well.


Alex Memering | Software Engineer | meme...@google.com 

Reply all
Reply to author
Forward
0 new messages