TWegg_95
TWegg_95

Reputation: 25

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.

Upvotes: 1

Views: 84

Answers (1)

Louis C
Louis C

Reputation: 665

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.

Upvotes: 1

Related Questions