I have a Firebase project that does not have billing enabled. I want to create database backups using a VM that belongs to another, billing-enabled project. The backup script is as simple as:
.npm/bin/firebase --project $PROJECT_ID database:get /
A freshly created Service Account is assigned to the VM running this script (through GCE). If this account doesn't have access to project $PROJECT_ID
, then obviously this fails:
Error: Authorization failed. This account is missing the following required permissions on project $PROJECT_ID:
firebase.projects.get
firebasedatabase.instances.get
But giving these specific permissions to the service account, or even assigning "Owner" role to that project doesn't make it much better. Instead:
Error: HTTP Error: 404, The specified project was not found.
Running with --debug
shows that specifically GET https://admin.firebase.com/v1/projects/$PROJECT_ID
returns 404.
The project exists, which I verify by running the exact same command with my own (non-service) account on my workstation. I have also verified that the account is the correct one by running gcloud auth list
on the VM. The project also shows up in the gcloud projects list
output on the same VM.
Is there a way to make the service account work cross-project and access Firebase Database?