【问题标题】:How to Import Production Data From Cloud Firestore to the Local Emulator?如何将生产数据从 Cloud Firestore 导入本地模拟器?
【发布时间】:2021-05-13 13:23:04
【问题描述】:

我想在本地 firebase 模拟器套件中制作我的应用程序原型。

我的 Firestore 数据库中已经有一些生产数据,我想将这些数据导入到我的模拟器中,我正在遵循以下指南:

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

但是我在尝试执行此步骤时遇到错误:

3。将您的生产数据导出到 Google Cloud Storage 存储分区,并提供您选择的名称:

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

我的代码:

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

我收到以下错误:

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

如果我试图通过导入来创建文件,文件怎么会不存在?我究竟做错了什么?我还有其他方法可以传输数据吗?

【问题讨论】:

  • 我不知道答案,但是 - 你什么时候得到错误?导出时,或尝试导入模拟器,或将导出的文件下载到本地存储...?

标签: firebase google-cloud-platform google-cloud-firestore


【解决方案1】:

正确的命令是gcloud firestore export gs://[BUCKET_NAME]

所以,在你的情况下gcloud firestore export gs://myapp-proto.appspot.com/myapp-proto-data

myapp-proto.appspot.com/myapp-proto-data 是您已经创建的存储桶吗?如果不确定存储的 URI 是否正确,并且在运行此命令之前存储桶确实存在。

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

【讨论】:

  • 这个答案看起来不正确,因为导入只适用于生产 Firebase。您无法以这种方式将其导入 Firebase Emulator。如果我错了,请纠正我。
猜你喜欢
  • 2020-01-10
  • 1970-01-01
  • 2019-11-13
  • 1970-01-01
  • 1970-01-01
  • 2019-07-18
  • 1970-01-01
  • 2020-07-28
  • 1970-01-01
相关资源
最近更新 更多