bun icon indicating copy to clipboard operation
bun copied to clipboard

Maximum url length (or header size) is different from Node's default

Open exKAZUu opened this issue 1 year ago • 1 comments

What version of Bun is running?

1.1.2

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

  1. Launch fastify + tRPC server on Bun
  2. Access to the server via tRPC client with batch which generates a very long url (the url length is more than 8000)
    • Like await Promise.all([<long array>].map(param => trpcClient.xxx.query({ param })));
  3. An error occurs due to cause: SocketError: other side closed
    • If we use maxURLLength: 8000 in the options of tRPC Client, then the error doesn't occur.

What is the expected behavior?

An error should not occur on the step 3.

What do you see instead?

TRPCClientError: fetch failed
    at TRPCClientError.from (file:///Users/exkazuu/xxx/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs:38:16)
    at file:///Users/exkazuu/xxx/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs:128:36 {
  meta: {},
  shape: undefined,
  data: undefined,
  [cause]: TypeError: fetch failed
      at node:internal/deps/undici/undici:12618:11 {
    cause: SocketError: other side closed
        at Socket.onSocketEnd (node:internal/deps/undici/undici:9169:26)
        at Socket.emit (node:events:530:35)
        at endReadableNT (node:internal/streams/readable:1696:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
      code: 'UND_ERR_SOCKET',
      socket: [Object]
    }
  }
}

Additional information

We don't use --max-http-header-size option in Node.js.

exKAZUu avatar Apr 09 '24 03:04 exKAZUu

We also need to make the error message better.

Electroid avatar Apr 09 '24 17:04 Electroid