Effect CommunityEC
Effect Community2y ago
12 replies
danielo515

HttpClient PUT vs. Fetch PUT Issue

I have a problem using httpclient put while a normal fetch works just fine while uploading an image to S3 using a pre-signed URL.
This is the funciton to upload the file:
const uploadWithSignedUrl = (file: File, url: string) =>
  HttpClient.request
    .put(url)
    .pipe(
      HttpClient.request.fileWebBody(file),
      HttpClient.client.fetchOk,
      HttpClient.response.void,
      Effect.retry(retryPolicy),
      Effect.withLogSpan("uploadWithSignedUrl"),
    )

Taht fails with net::ERR_H2_OR_QUIC_REQUIRED, while a normal fetch just like this: fetch(url, { method: "PUT", body: file }).then(console.log); works without problems. What is the reason?
Was this page helpful?