Deploy to Firebase hosting using Bitbucket Pipeline

On and off I’ve played around with Firebase and one thing I had never tried out was the hosting part of Google’s offering. I spent a bit of time a few nights ago getting familiar with it and didn’t like the fact that I had to deploy from the command line as I generally like to do my deployments via git.

This excellent blog post showed me what I needed to do and everything seemed easy enough. Here is my original pipeline.yml

image: node:8.4.0
pipelines:
branches:
master:
- step:
deployment: production
caches:
- node
script:
- npm install -g firebase-tools
- firebase deploy --token=$FIREBASE_TOKEN --project mySite --non-interactive

When my pipeline ran I received the following error.

Error: Authorization failed. This account is missing the following required permissions on project <project>:
firebase.projects.get
firebasehosting.sites.update

The issue was resolved when I looked at the –project parameter. Everything I read said project name, but in reality it needs to be the project ID, which you can get from Firebase project console. Once this was rectified the pipeline ran succesfully.

~david