Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix experimental undici warning (vercel#41077)
Browse files Browse the repository at this point in the history
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`
ijjk authored and Kikobeats committed Oct 24, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent abf0044 commit 7401c25
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/next/server/config.ts
Original file line number Diff line number Diff line change
@@ -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`'
5 changes: 5 additions & 0 deletions test/e2e/prerender.test.ts
Original file line number Diff line number Diff line change
@@ -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')
})

0 comments on commit 7401c25

Please sign in to comment.