1

I am running the command 'firebase init storage' and am getting the following error...

Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it.

I am writing a script to initialize my project, so I do not want to have to do things manually in a web console if I don't have to.

How can I set the Cloud resource location for my project using either firebase cli or gcloud tools?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Scorb
  • 1,654
  • 13
  • 70
  • 144
  • The location of the project is determined when the [project is created](https://cloud.google.com/firestore/docs/locations#default-cloud-location). You want to change the project's location once it has been deployed using the firebase CLI or gcloud tools? – Andres Fiesco Casasola Jun 15 '22 at 14:14
  • @AndresFiescoCasasola This is incorrect, as my project is definitely created, even through it does not have a default location set. – Scorb Jun 15 '22 at 23:09

1 Answers1

0

Similar concern "Firebase Project Initialization Error: Cloud resource location is not set for this project".

This might help you:

  • Go to the Firebase console and open your project
  • Go to the Storage tab ( Side panel on left )
  • Click setup storage
  • Run Firebase init again

You may use the REST API to create a script to initialize your project.

REST API sample curl:

curl --request POST \
  'https://firebase.googleapis.com/v1beta1/projects/<"PROJECT-ID">/defaultLocation:finalize' \
  --header 'Authorization: Bearer '$(gcloud auth application-default print-access-token) \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"locationId":<"REGION-NAME">}' \
  --compressed

Check these documentation for reference:

Note: After the default GCP resource location is finalized, or if it was already set, it cannot be changed.

Unfortunately, Firebase CLI and Gcloud tools have not yet been implemented to set the Cloud resource location. However you can file a Feature Requests that you might think is helpful.

Chanpols
  • 1,184
  • 1
  • 3
  • 13