question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: ReadableStream is not defined

See original GitHub issue

Describe the bug

If chunker.ts falls through a bunch of analysis cases it refers to the ReadableStream symbol, which is not imported or defined anywhere (and so is undefined):

https://github.com/aws/aws-sdk-js-v3/blob/28008c2a3e30cd234f447484d76777d5db56dad1/lib/lib-storage/src/chunker.ts#L22

A clear and concise description of what the bug is.

Your environment

SDK version number

@aws-sdk/lib-storage@3.13.1

Is the issue in the browser/Node.js/ReactNative?

Node

Steps to reproduce

import tar from 'tar';

        const source = tar.c({
          gzip: true,
          cwd: files.root,
        }, files.fileNames);

        const upload = new Upload({
          client: await this.s3(),
          queueSize: 4, // optional concurrency configuration
          leavePartsOnError: false, // optional manually handle dropped parts
          params: {
            Bucket: this.bucketName,
            Key: this.remoteDataKey(pv),
            Body: source,
          },
        });

Observed behavior

ReferenceError: ReadableStream is not defined

Expected behavior

Not this exception.

Additional context

To my mind a readable stream produced by the tar package should just work, but from the source in chunker.ts I can tell it’s not going to because that stream fails the type analysis.

Unfortunately this looks like it’s going to break with much of Node’s duck-typed ecosystem.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
garrett-hoppercommented, Jun 4, 2021

I just ran into this issue when using jszip which uses readable-stream. When @aws-sdk/lib-storage tried to check if the Body was a Readable, it was a different readable-stream instance of Readable rather than the Node.js Readable. Setting a READABLE_STREAM=disable environment variable (see readable-stream readable.js#L2) resolves this, however it doesn’t seem ideal. I’m not sure where the change should occur though. Should @aws-sdk/lib-storage check for the readable-stream instance?

@alexforsyth, can this issue be reopened?

0reactions
github-actions[bot]commented, Jun 24, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReadableStream is not defined (lib-storage chunker error on ...
I'm not sure about @alexforsyth not being able to reproduce the original issue, as the chunker at lib-storage/src/chunker.ts#L22 definitely doesn't handle ...
Read more >
ReadableStream is not defined" - Stack Overflow
When calling pageContent.getTextContent() , which should return a promise, the error " ReferenceError: ReadableStream is not defined " is thrown ...
Read more >
ReadableStream is not defined"-node.js - appsloveworld
Coding example for the question Unable to parse page text, getting "ReferenceError: ReadableStream is not defined"-node.js.
Read more >
ReadableStream - Web APIs - MDN Web Docs
Chrome Edge ReadableStream Full support. Chrome43. Toggle history Full support. Edge14... ReadableStream() constructor Full support. Chrome43. Toggle history Full support. Edge79... cancel Full support. Chrome43. Toggle...
Read more >
readable-stream - npm
Node.js Streams, a user-land copy of the stream library from Node.js. Latest version: 4.2.0, last published: 3 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found