TypeError: Response.clone: Body has already been consumed

Since I have added the flag to fix the UNDICI issue I have been getting this error

TypeError: Response.clone: Body has already been consumed.
    at i.errors.exception (/opt/rust/undici.js:1:198781)
    at lA.clone (/opt/rust/undici.js:39:21106)
    at /var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:181023 {
  digest: '2427883810'
}

I do not anywhere use the Response.clone method so unsure what part of my project is causing this issue. Any help would be appreciated

Hi, @psl-it! Welcome to the Vercel Community.

Thanks for your patience! Could you share a minimal reproducible example with us? It’d be very helpful to understand how/where this error came from.

I don’t actually know where this error comes from as it only appears in my production code when I apply the environment variable flag of VERCEL_UNDICI=1 . When the flag is not present everything works as intended minus the occasional issue that the flag was supposed to fix. But we have workarounds that cause a refresh that basically solve the error. This flag error however we do not have a workaround for so I am very worried for when that patch goes fully live

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hi,

We have implemented a fix for the issue you reported in Next.js. This fix has been applied to both Next.js v14.2.20 and the latest canary version of Next.js.

The root of this issue lies in the clone implementation of undici , and we will also report this to their repository. This will alert their team about the problem and help prevent similar issues in the future.

To apply this fix on your end, we recommend upgrading to the latest version of Next.js. Once you have done this, would you mind letting us know if you are still experiencing any issues?