next.js icon indicating copy to clipboard operation
next.js copied to clipboard

WebSocket HMR fails to connect when NODE_TLS_REJECT_UNAUTHORIZED env is set to 0

Open anthonyma94 opened this issue 3 years ago • 0 comments

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

  1. Create a new Next.JS project.
  2. Set NODE_TLS_REJECT_UNAUTHORIZED=0
  3. Start the dev server and open a browser to connect.

anthonyma94 avatar Oct 30 '22 18:10 anthonyma94