How to Import Production Data From Cloud Firestore to the Local Emulator?

Viewed 492

I want to prototype my app in local firebase emulator suite.

I already have some data from production in my firestore database that I want to import to my emulator and I am following the guide below:

https://medium.com/firebase-developers/how-to-import-production-data-from-cloud-firestore-to-the-local-emulator-e82ae1c6ed8

However I am getting the error when trying to do this step:

3. Export your production data to a Google Cloud Storage bucket, providing a name of your choice:

gcloud firestore export gs://your-project-name.appspot.com/your-choosen-folder-name

my code:

gcloud firestore export gs://myapp-proto.appspot.com/myapp-proto-data

I get the following error:

ERROR: (gcloud.firestore.export) NOT_FOUND: Google Cloud Storage file does not exist:

How can file not exist if I am trying to create it by importing it? what am I doing wrong? is there another way for me to transfer data?

1 Answers

the correct command is gcloud firestore export gs://[BUCKET_NAME]

so, in your case gcloud firestore export gs://myapp-proto.appspot.com/myapp-proto-data

does myapp-proto.appspot.com/myapp-proto-data is the bucket you have created already? if not make sure the buckted URI is correct and bucket do exist before running this command.

Reference: https://firebase.google.com/docs/firestore/manage-data/export-import#gcloud

Related