【问题标题】:Error downloading from firebase Storage in a Cloud Function从 Cloud Function 中的 firebase 存储下载时出错
【发布时间】:2019-08-06 13:07:39
【问题描述】:

我有以下代码可以从 Firebase 存储中下载 .txt 文件:

    const objectName = `${isla}/${localidad}/${zona}/map.txt`;
    const file = storage.bucket(config["storageBucket"]).file(objectName);
    const tmpFilePath = path.join(os.tmpdir(), "map.txt");
    await file.download({destination: tmpFilePath});

但它会引发错误:

    Error: _read() is not implemented at Duplex.Readable._read 
    (_stream_readable.js:551:22) at Duplex.Readable.read 
    (_stream_readable.js:442:10) at resume_ (_stream_readable.js:822:12) at 
    _combinedTickCallback (internal/process/next_tick.js:139:11) at 
    process._tickDomainCallback (internal/process/next_tick.js:219:9)

我之前使用过这种方法没有问题,但不确定我做错了什么,因为我没有尝试设置流。任何帮助表示赞赏,谢谢。

【问题讨论】:

  • 有趣的是,我也在今天之前工作的代码上看到了这一点。
  • 看起来这是一个新错误。 github.com/googleapis/nodejs-storage/issues/798
  • 感谢上帝,我以为我要疯了
  • @bob2 您应该在正式答案中发布解决方法,在 github 错误中说明

标签: javascript node.js google-cloud-functions google-cloud-storage


【解决方案1】:

正如@bob2 所说,它是known bug

错误中建议的解决方法是:

如果你 rm -rf node_modules package-lock.json 然后再次 npm install ,一切都应该按预期工作。

【讨论】:

    猜你喜欢
    • 2016-09-25
    • 2018-03-08
    • 2018-02-28
    • 2017-10-21
    • 2020-04-29
    • 1970-01-01
    • 2021-02-13
    • 2020-07-09
    • 2018-10-01
    相关资源
    最近更新 更多