@google-cloud/storage version: >=2.2.0 (works in 2.1.0)const { Storage } = require("@google-cloud/storage");
const s = new Storage();
const bucket = s.bucket("add-bucket-here");
const file = bucket.file("some-file-here.md");
file.download();
```
Expected: script runs successfully.
Actual: A TypeError occurs:
```shell
TypeError: rawResponseStream.toJSON is not a function
at onResponse (/node_modules/@google-cloud/storage/build/src/file.js:413:51)
at Util.handleResp (/node_modules/@google-cloud/common/build/src/util.js:123:9)
at Duplexify.requestStream.on.on.res (/node_modules/@google-cloud/storage/build/src/file.js:392:31)
at Duplexify.emit (events.js:180:13)
at DestroyableTransform.emit (events.js:180:13)
at onResponse (/node_modules/retry-request/index.js:194:19)
at PassThrough.<anonymous> (/node_modules/retry-request/index.js:149:11)
at PassThrough.emit (events.js:180:13)
at /node_modules/teeny-request/build/src/index.js:186:29
at <anonymous>
Had a look in the debugger - and this stream has no such function, it has a headers object though?
This commit fixes the issue. However I wouldn't be comfortable making a PR out of this because I'm casting to a Readable which may not always be the case?
We have a fix here: https://github.com/fhinkel/teeny-request/pull/32
With the same environment details, this also has broken our application.
Source code:
const f = getBucket(bucket)
.file(file)
.download()
.then(contents => {
// nothing happens, timeout
})
.catch(err => {
// nothing happens, timeout
});
@kinwa91 that update of fhinkel/teeny-request fixed me having the same issue. the speediness of the fix is much appreciated! :+1:
Since this appears to be fixed - I'm going to go ahead and close this out for now. If folks are still having trouble with the latest and greatest, please do let us know!
Most helpful comment
@kinwa91 that update of fhinkel/teeny-request fixed me having the same issue. the speediness of the fix is much appreciated! :+1: