Skip to content

Node v18.15.0 and higher ignore --max-http-header-size #47246

@havran

Description

@havran

Version

v18.15.0 and v19.8.1

Platform

Linux FESK-LTP0007 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 22.04)

Subsystem

No response

What steps will reproduce the bug?

I use urql in my NextJS application, to communicate with backend CMS. For some query CMS send extra large headers with response (around 22kb).

I use node 18 as runner for project where I use URQL library to GraphQL request to backend CMS, but there I get console error:

[newro-15509] Network Error! CombinedError: [Network] fetch failed
    at makeErrorResult (file:///data/***/node_modules/@urql/core/dist/urql-core-chunk.mjs:284:10)
    at file:///data/***/node_modules/@urql/core/dist/urql-core-chunk.mjs:462:15 {
  graphQLErrors: [],
  networkError: TypeError: fetch failed
      at Object.fetch (node:internal/deps/undici/undici:11457:11) {
    cause: HeadersOverflowError: Headers Overflow Error
        at Parser.trackHeader (node:internal/deps/undici/undici:9453:37)
        at Parser.onHeaderValue (node:internal/deps/undici/undici:9448:14)
        at wasm_on_header_value (node:internal/deps/undici/undici:9257:34)
        at wasm://wasm/00036ac6:wasm-function[49]:0xf91
        at wasm://wasm/00036ac6:wasm-function[68]:0x7316
        at wasm://wasm/00036ac6:wasm-function[67]:0x154d
        at wasm://wasm/00036ac6:wasm-function[21]:0x552
        at Parser.execute (node:internal/deps/undici/undici:9373:26)
        at Parser.readMore (node:internal/deps/undici/undici:9352:16)
        at Socket.onSocketReadable (node:internal/deps/undici/undici:9660:14) {
      code: 'UND_ERR_HEADERS_OVERFLOW'
    }
  },
  response: undefined
}

I investigate and I found solution to set http header size by using environment: NODE_OPTIONS=--max-http-header-size=32768

This seems to be ignored for Node version 18 and higher (I also try node 19). On Node 16, this environment variable solve error.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

I see error message:

[newro-15509] Network Error! CombinedError: [Network] fetch failed
    at makeErrorResult (file:///data/***/node_modules/@urql/core/dist/urql-core-chunk.mjs:284:10)
    at file:///data/***/node_modules/@urql/core/dist/urql-core-chunk.mjs:462:15 {
  graphQLErrors: [],
  networkError: TypeError: fetch failed
      at Object.fetch (node:internal/deps/undici/undici:11457:11) {
    cause: HeadersOverflowError: Headers Overflow Error
        at Parser.trackHeader (node:internal/deps/undici/undici:9453:37)
        at Parser.onHeaderValue (node:internal/deps/undici/undici:9448:14)
        at wasm_on_header_value (node:internal/deps/undici/undici:9257:34)
        at wasm://wasm/00036ac6:wasm-function[49]:0xf91
        at wasm://wasm/00036ac6:wasm-function[68]:0x7316
        at wasm://wasm/00036ac6:wasm-function[67]:0x154d
        at wasm://wasm/00036ac6:wasm-function[21]:0x552
        at Parser.execute (node:internal/deps/undici/undici:9373:26)
        at Parser.readMore (node:internal/deps/undici/undici:9352:16)
        at Socket.onSocketReadable (node:internal/deps/undici/undici:9660:14) {
      code: 'UND_ERR_HEADERS_OVERFLOW'
    }
  },
  response: undefined
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions