简体   繁体   中英

Error downloading from firebase Storage in a Cloud Function

I have the following code to download a .txt file from a firebase storage:

    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});

but it throws the error:

    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)

I've used this method before with no problems, not sure what I've done wrong as I'm not trying to set up a stream. Any help is appreciated, thanks.

As @bob2 mentioned it's a known bug .

A workaround suggested in the bug is:

If you rm -rf node_modules package-lock.json and then npm install again, everything should be working as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM