Skip to content

Fix fetchOptions dispatcher with undici v8#1894

Open
puneetdixit200 wants to merge 1 commit into
openai:masterfrom
puneetdixit200:fix-undici-dispatcher
Open

Fix fetchOptions dispatcher with undici v8#1894
puneetdixit200 wants to merge 1 commit into
openai:masterfrom
puneetdixit200:fix-undici-dispatcher

Conversation

@puneetdixit200
Copy link
Copy Markdown

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Fixes #1886.

Node's built-in fetch can pass the older undici dispatch handler shape into a user-provided dispatcher. Newer undici@8 dispatchers reject that handler with UND_ERR_INVALID_ARG: invalid onRequestStart method, which breaks the documented fetchOptions.dispatcher proxy setup.

This wraps dispatcher calls with a compatibility adapter that forwards the older handler callbacks to the newer request lifecycle callbacks while leaving dispatchers that already receive the newer handler shape unchanged.

Additional context & links

Tests run:

  • ./scripts/test tests/index.test.ts
  • ./scripts/build
  • built-package smoke test with undici@8.3.0 ProxyAgent verifying the failure changes from invalid onRequestStart method to a normal proxy connection error
  • ./scripts/lint
  • ./scripts/test
  • git diff --check

@puneetdixit200 puneetdixit200 requested a review from a team as a code owner May 22, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fetchOptions.dispatcher not work for "undici": "^8.3.0"

1 participant