next.js
next.js copied to clipboard
WebSocket HMR fails to connect when NODE_TLS_REJECT_UNAUTHORIZED env is set to 0
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022 Binaries: Node: 16.18.0 npm: 8.19.2 Yarn: 1.22.19 pnpm: N/A Relevant packages: next: 12.3.1 eslint-config-next: 12.3.1 react: 18.2.0 react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
When NODE_TLS_REJECT_UNAUTHORIZED is set to 0, WebSocket HMR fails to connect.
Firefox can’t establish a connection to the server at ws://localhost:4200/_next/webpack-hmr.
The connection to ws://localhost:4200/_next/webpack-hmr was interrupted while the page was loading.
The dev instance is running locally, behind WSL and Docker. There is no custom server involved.
Expected Behavior
HMR should connect even with NODE_TLS_REJECT_UNAUTHORIZED set to 0.
Link to reproduction
Cannot reproduce online
To Reproduce
- Create a new Next.JS project.
- Set NODE_TLS_REJECT_UNAUTHORIZED=0
- Start the dev server and open a browser to connect.