confluentinc / confluentinc/vscode

`fetch` response is rejected in upload artifact flow

Open
#2,487 3 comments 0 reactions 1 assignee Claimed by @bcscc View on GitHub
on hold
Dominant language
TypeScript
Stars
34
Forks
17
Avg merge
1d 22h
Merged PRs (30d)
8

Description

We're getting "promise rejected" at the fetch call [here](https://github.com/confluentinc/vscode/blob/main/src/commands/utils/uploadToS3.ts#L47) during debugging, even though **the upload flow eventually works**.

This is because [response bodies in the Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Response#instance_properties) are ReadableStreams that can only be consumed once, and the call to `response.text()` consumes the stream, marking it as "released" for any further callers. Best to use `response.clone()` to keep a readable copy around for using later.

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.