1

I need to deploy firebase cloud functions programmatically What I am doing. I have firebase cli install on ubuntu and have written bash script. I create a firebase project then initialize my database and firebase functions. I attach billing account using gcloud cli. I am doing all things from firebase cli and do want any things from console.

After all this steps i ran a command firebase deploy --only functions Then there is a error Cloud resource location is not set for this project but scheduled functions requires it.

When I set from console the above command runs successfully. I set location as shown in the image Set Default GCP resource location

Please let us know how I can Default GCP resource location through firebase cli?

  • I had a quick look into this for you and I think it's not possible. There are environment settings with the Google Cloud SDK (`gcloud`) that effect this behavior (https://cloud.google.com/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client) and I learned researching this question that there's a way to set these values for Compute Engine using the Metadata Server (https://cloud.google.com/compute/docs/regions-zones/changing-default-zone-region) but this only applies to VMs. – DazWilkin Apr 03 '21 at 15:59
  • If the resource location is set, [projects:get](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/get) includes `resources.locationId` and it's possible (but I've not tried) that you could PATCH this value using [projects:patch](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/patch) – DazWilkin Apr 03 '21 at 15:59
  • Are you referring to Gcloud or firebase cli? I will try my self if you share commands – aqiltariq65 Apr 05 '21 at 16:40
  • I think it's not possible with Firebase CLI. With Cloud SDK (`gcloud`), it's possible to e.g. `gcloud config set compute/[region|zone]` ([link](https://cloud.google.com/sdk/gcloud/reference/config/set#compute)) but the effect of this is client-side and only applicable to, in that case, Compute Engine. There's nothing for Firebase. The only (!?) alternative would be to make a REST call against the Firebase API, `PATCH`ing the service's values but I've not tried it and it may not work. – DazWilkin Apr 05 '21 at 17:32
  • Let me try the firebase API `Patch` call. I will try this and let you know. Can you please tell me the details of `Patching` the service's value? – aqiltariq65 Apr 06 '21 at 08:20
  • @aqiltariq65 - I think you should raise this as Feature Request or Bug on [Firebase Support](https://firebase.google.com/support/troubleshooter/report) – vitooh Apr 20 '21 at 06:57

0 Answers0