Docs: Cannot add agent option in fetch() call #43354
Labels
Developer Experience
Issues related to Next.js logs, Error overlay, etc.
TypeScript
Related to types with Next.js.
What is the improvement or update you wish to see?
The current docs for "Disabling HTTP Keep-Alive" mentions it is possible to set the
agent
option in an individualfetch()
call. However as of Next.js 13.0.4, this produces a type error.The
fetch
type comes from the TypeScriptlib.dom.d.ts
which does not allow for specifying theagent
because it is a client-side definition offetch
in the browser.Repro: https://stackblitz.com/edit/vercel-next-js-bar5lp?file=pages/index.tsx
Is there any context that might help us understand?
I think the confusion arises because Next.js automatically polyfills
node-fetch
where theagent
option is applicable, I'm not sure how TypeScript type could distinguish between thefetch
being used on the server-side or client-side.Does the docs page already exist? Please link to it.
https://nextjs.org/docs/api-reference/next.config.js/disabling-http-keep-alive
The text was updated successfully, but these errors were encountered: