Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix experimental undici warning #41077

Merged
merged 2 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/next/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`'
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/prerender.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down