Skip to content

Logging a response consumes request body #18

@theduke

Description

@theduke
addEventListener('fetch', (req) => {
  req.respondWith(handle(req));
});

async function handle(req) {
  let resp = await fetch("https://wasmer.io");
  console.log(resp);
  const body = await resp.text();
  return new Response('hello');
}

Error:

2023-10-29T13:26:29.872440Z ERROR wasmer_winter::server: could not process request error="Error {\n    context: \"javascript failed\",\n    source: \"Script execution failed: Response body has already been used.\",\n}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglinearCreated by Linear-GitHub Sync

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions