【问题标题】:Error importing .json file to Firestore with firestore-import使用 firestore-import 将 .json 文件导入 Firestore 时出错
【发布时间】:2021-05-20 05:00:51
【问题描述】:

我使用firestore-export 导出了我的Firestore 数据库并将其写入json 文件。

我必须阅读this thread 才能将数据正确写入文件。我决定用这个命令增加内存空间:

export NODE_OPTIONS="--max-old-space-size=16384"

我也更新到node版本16,建议更新到最新版本。

$ node --version
v16.2.0

当我尝试将该文件导入另一个数据库实例以实现冗余时,它不起作用。

firestore-import -a admin-sdk-key.json -b export.json

只写入了部分数据,操作中止。完整的错误输出在此处链接的 Pastebin 上:

https://pastebin.com/qAYrkk1X

很多错误看起来像这样

Caused by: Error
    at WriteBatch.commit (/usr/local/lib/node_modules/node-firestore-import-export/node_modules/@google-cloud/firestore/build/src/write-batch.js:415:23)
    at /usr/local/lib/node_modules/node-firestore-import-export/dist/lib/import.js:67:22
    at Array.map (<anonymous>)
    at setDocuments (/usr/local/lib/node_modules/node-firestore-import-export/dist/lib/import.js:52:34)
    at Object.importData [as firestoreImport] (/usr/local/lib/node_modules/node-firestore-import-export/dist/lib/import.js:26:41)
    at /usr/local/lib/node_modules/node-firestore-import-export/dist/bin/firestore-import.js:77:17
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/node-firestore-import-export/dist/bin/firestore-import.js:6:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 13,
  details: 'Received RST_STREAM with code 2',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} },
  note: 'Exception occurred in retry method that was not classified as transient'
}

【问题讨论】:

    标签: javascript node.js google-cloud-firestore


    【解决方案1】:

    在提供的日志中发现错误Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhausted 表明该项目超出了其配额或区域/多区域容量,因此您的应用执行的读取操作可能比预期的要多。

    您可以在this linkthis one查看更多信息。

    如果您选择允许您的应用超出免费配额,you must enable billing for your Cloud Platform project

    【讨论】:

      猜你喜欢
      • 2018-08-11
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 2020-06-02
      • 2020-04-06
      • 2021-11-05
      • 2017-10-14
      • 1970-01-01
      相关资源
      最近更新 更多