Skip to content

response.body is not async iterable #10

@Glauy

Description

@Glauy

const response = await fetch(CHAT_COMPLETIONS_URL, requestOpts);
const newData of response.body as unknown as NodeJS.ReadableStream

Why the following error:
response.body is not async iterable

The solution I found is the following, but you can operate normally:
The error you encounter is because response.body is not an Async Iterable. In the standard Fetch API, response.body is a ReadableStream, which is not an asynchronous iterable, so you can't use it directly. Let's go through it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions