This reproduction has only two runtime dependencies:
undici7->npm:undici@7.27.1undici8->npm:undici@8.3.0
It starts a local HTTP server on 127.0.0.1 so the result does not depend on external networking.
pnpm install
pnpm ok
pnpm koExpected:
pnpm oksucceeds becauseundici@8fetch uses anundici@8global dispatcher.pnpm kofails becauseundici@7fetch picks up the process-global dispatcher installed byundici@8.
The failing shape is:
import * as undici7 from 'undici7'
import * as undici8 from 'undici8'
undici8.setGlobalDispatcher(new undici8.Agent())
await undici7.fetch('http://127.0.0.1:PORT/')The failure is TypeError: fetch failed, caused by undici 8 rejecting the undici 7 request handler object:
InvalidArgumentError: invalid onRequestStart method
at assertRequestHandler (.../undici@8.3.0/.../lib/core/util.js)
...
at .../undici@7.27.1/.../lib/web/fetch/index.js