nodejs-storage: Using File.download() throws _read() method is not implemented
⚠️ BLOCKED
This section was added by @stephenplusplus.
Environment details
- OS: Windows 10 version 1903
- Node.js version: 10.16.1
- npm version: 6.9.0
@google-cloud/storage
version: 3.0.4
Steps to reproduce
- Create a new Storage class, use any bucket available in your Google Cloud Dashboard
import {Storage} from '@google-cloud/storage'
gcloudstorage = new Storage({projectId: <yourgcloud_proyectid>, keyFilename: <keyfilenamepath>})
const storage_bucket = gcloudstorage.bucket(<yourgcloud_bucketname>)
- Inside an async function declare the path variables to get the file and download the file
let filepath = 'company_' + <a_function_parameter> + '_usersignature_' + <another_function_parameter> + '.png'
let anonFilename = Math.random().toString(36).replace('0.', '') //generates a random string
let savePath = __dirname + '../../../downloads/' + anonFilename + '.png'
- Download the file inside the async block using await
await storage_bucket.file(filepath).download({destination: savePath})
Running these lines you finally get
Error [ERR_METHOD_NOT_IMPLEMENTED]: The _read() method is not implemented
at Duplex.Readable._read (_stream_readable.js:627:24)
at Duplex.Readable.read (_stream_readable.js:470:10)
at resume_ (_stream_readable.js:949:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
PD: I also verified that the file already exists. tried the 3.0.3 version of @google-cloud/storage
with no luck
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 16
- Comments: 21 (6 by maintainers)
The rollback of the
latest
dist tag on@google-cloud/common
is complete. Folks on the thread - if yourm -rf node_modules package-lock.json
and thennpm install
again, everything should be working as expected.I’m downgrading this to a P2 and keeping the issue open to investigate what created the failures in
@google-cloud/common
version2.1.0
.I get suddenly the same error. I’m using firebase storage (which is a wrapper for google cloud storage). A simple re-deploy caused that error. I assume the new version of pumpify https://github.com/googleapis/nodejs-storage/pull/740 causes that.