Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot getReader of ReadableStream #25

Open
robinsadeghpour opened this issue Mar 25, 2024 · 3 comments
Open

Cannot getReader of ReadableStream #25

robinsadeghpour opened this issue Mar 25, 2024 · 3 comments

Comments

@robinsadeghpour
Copy link

Hey,

I cannot get the reader from the readableStream I get following Error:
Error: [TypeError: This stream has already been locked for exclusive reading by another reader]

I also have added the auto import for the polyfills to the root _layout.tsx as I use filebased routing.
import 'react-native-polyfill-globals/auto';

const res = await fetch("https://www.lotti.ai/api/lotti", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Connection: "keep-alive",
        },
        mode: "cors",
        body: JSON.stringify(message),
        "reactNative": { textStreaming: true }
      })

      const reader = res.body?.getReader();
image

I should also mention that the type for reactNative: {textStreaming: true} seems to not be detected correctly:
image

@hhjin
Copy link

hhjin commented Jun 21, 2024

The solution is:
npm install [email protected]
Because the latest version of web-streams-polyfill (4.x) only has polyfill of ES5. But the repo is using ES6 polyfill.

@dimonnwc3
Copy link

@robinsadeghpour did you find a solution?

@djaffer
Copy link

djaffer commented Jul 17, 2024

All solutions shared doesn't work. Body obj doesn't have stream support in hermes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants