Skip to content

Failed to read data from the ReadableStream: “TypeError: attempting to access detached ArrayBuffer”. when fetch() are called simultaneously on Firefox #3

@Utaea

Description

@Utaea
useEffect(() => {
    fetch(`http://localhost:5173/1.db.xz`)
      .then(compressedResponse => {
        const decompressedResponse = new Response(
          new XzReadableStream(compressedResponse.body!)
        );
        return decompressedResponse.arrayBuffer();
      })
      .catch(error => {
        console.error('Error:', error);
      });
    
    fetch(`http://localhost:5173/2.db.xz`)
      .then(compressedResponse => {
        const decompressedResponse = new Response(
          new XzReadableStream(compressedResponse.body!)
        );
        return decompressedResponse.arrayBuffer();
      })
      .catch(error => {
        console.error('Error:', error);
      });
}, []);

Code above works fine on Chrome, but on Firefox this will lead to Failed to read data from the ReadableStream: “TypeError: attempting to access detached ArrayBuffer”., and this error will occur only when multiple fetch() (or multiple decompression thread?) are running simultaneously

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