Repository: next.js
Issue: InvalidArgumentError: invalid transfer-encoding header after update to next 13.3.0
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: linux
      Arch: x64
      Version: #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2
    Binaries:
      Node: 18.9.0
      npm: 8.19.1
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.3.0
      eslint-config-next: 13.3.0
      react: 18.2.0
      react-dom: 18.2.0
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

_No response_

### Link to the code that reproduces this issue

https://github.com/soasada/issue-nextjs

### To Reproduce

1. Do POST HTTP request to `api`.
2. Delegate POST to another backend using built in nodejs `fetch` and copying all headers from nextjs request.

### Describe the Bug

Hi,

After upgrading my project to nextjs 13.3.0, my BFF api is failing to delegate requests to my backend. I tried to use the canary version and the same issue happened. I tried to downgrade to 13.2.4 and issue disappears.

I'm using the experimental nodejs api of fetch, I am using it since ~a year ago, with no issues.

In the provided code I have a method that extracts all headers from nextjs request and delegates them to the backend request.

**As a workaround**, if I remove the `transfer-encoding` header is working fine and the request reach the backend.

The exception:

```
TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:6406:34)
    at node:internal/deps/undici/undici:6727:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: InvalidArgumentError: invalid transfer-encoding header
      at processHeader (node:internal/deps/undici/undici:2668:15)
      at new Request (node:internal/deps/undici/undici:2553:13)
      at [dispatch] (node:internal/deps/undici/undici:3505:25)
      at Client.dispatch (node:internal/deps/undici/undici:401:33)
      at [dispatch] (node:internal/deps/undici/undici:620:32)
      at Pool.dispatch (node:internal/deps/undici/undici:401:33)
      at [dispatch] (node:internal/deps/undici/undici:4795:27)
      at Agent.dispatch (node:internal/deps/undici/undici:401:33)
      at node:internal/deps/undici/undici:7101:83
      at new Promise (<anonymous>)
      at dispatch (node:internal/deps/undici/undici:7101:16)
      at httpNetworkFetch (node:internal/deps/undici/undici:7008:65)
      at httpNetworkOrCacheFetch (node:internal/deps/undici/undici:6910:39)
      at httpFetch (node:internal/deps/undici/undici:6764:43)
      at schemeFetch (node:internal/deps/undici/undici:6700:24)
      at node:internal/deps/undici/undici:6563:26
      at mainFetch (node:internal/deps/undici/undici:6580:11)
      at fetching (node:internal/deps/undici/undici:6537:7)
      at Agent.fetch2 (node:internal/deps/undici/undici:6417:20)
      at Object.fetch (node:internal/deps/undici/undici:7200:20)
      at fetch (node:internal/process/pre_execution:214:25)
      at handler (webpack-internal:///(api)/./pages/api/hello.ts:19:28)
      at /home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/api-utils/node.js:377:16
      at /home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/lib/trace/tracer.js:92:36
      at NoopContextManager.with (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
      at ContextAPI.with (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
      at NoopTracer.startActiveSpan (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)
      at ProxyTracer.startActiveSpan (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)
      at /home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/lib/trace/tracer.js:81:107
      at NoopContextManager.with (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
      at ContextAPI.with (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
      at NextTracerImpl.trace (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/lib/trace/tracer.js:81:32)
      at Object.apiResolver (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/api-utils/node.js:375:63)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async DevServer.runApi (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/next-server.js:571:9)
      at async Object.fn (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/next-server.js:1018:35)
      at async Router.execute (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/router.js:297:32)
      at async DevServer.runImpl (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/base-server.js:522:29)
      at async DevServer.run (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/dev/next-dev-server.js:869:20)
      at async DevServer.handleRequestImpl (/home/nico/GolandProjects/issue-nextjs/node_modules/next/dist/server/base-server.js:456:20) {
    code: 'UND_ERR_INVALID_ARG'
  }
}
```

### Expected Behavior

Request is correctly delegated to the backend with no errors in the `transfer-encoding` header.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_