Unverified Commit cfd58ae8 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix experimental undici warning (#41077)

Fixes: https://vercel.slack.com/archives/C03KAR5DCKC/p1664581332858249

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
parent a7f0332b
......@@ -49,12 +49,16 @@ const experimentalWarning = execOnce(
export function setHttpClientAndAgentOptions(options: NextConfig) {
if (semverGte(process.version, '16.8.0')) {
if (semverGte(process.version, '18.0.0')) {
if (
options.experimental?.enableUndici &&
semverGte(process.version, '18.0.0')
) {
Log.warn(
'`enableUndici` option is unnecessary in Node.js v18.0.0 or greater.'
)
} else {
;(global as any).__NEXT_USE_UNDICI = options.experimental?.enableUndici
}
;(global as any).__NEXT_USE_UNDICI = options.experimental?.enableUndici
} else if (options.experimental?.enableUndici) {
Log.warn(
'`enableUndici` option requires Node.js v16.8.0 or greater. Falling back to `node-fetch`'
......
......@@ -2428,6 +2428,11 @@ describe('Prerender', () => {
expect(next.cliOutput).not.toContain('Failed to update prerender cache')
})
it('should not have experimental undici warning', async () => {
await waitFor(1000)
expect(next.cliOutput).not.toContain('option is unnecessary in Node.js')
})
it('should not have attempted sending invalid payload', async () => {
expect(next.cliOutput).not.toContain('argument entity must be string')
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment