Skip to content

Cannot getReader of ReadableStream #25

Open

Description

@robinsadeghpour

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

Activity

  1. hhjin commented on Jun 21, 2024

    @hhjin

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

  2. dimonnwc3 commented on Jun 29, 2024

    @dimonnwc3

    @robinsadeghpour did you find a solution?

  3. djaffer commented on Jul 17, 2024

    @djaffer

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions