Skip to content

(Regression) Since v15.2.2-canary.3 The websocket HMR cannot connect when using a custom domain with ssl locally #77253

@Enrico2

Description

@Enrico2

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

To Reproduce

This is how I'm set up, I'm not sure if this is the minimal reproduction.

  1. Point a custom domain to your home IP.
  2. Port forward 13000 external -> 3000 internal
  3. Run next dev with --experimental-https --experimental-https-key [privkey pem file] --experimental-https-cert [fullchain pem]
  4. open yourdomain.com:13000
  5. Look at the developer console:
WebSocket connection to 'wss://enricode.com:13000/_next/webpack-hmr' failed: 
(anonymous) @ use-websocket.ts:16
react-stack-bottom-frame @ react-dom-client.development.js:24035
runWithFiberInDEV @ react-dom-client.development.js:1510
commitHookEffectListMount @ react-dom-client.development.js:10514
commitHookPassiveMountEffects @ react-dom-client.development.js:10635
commitPassiveMountOnFiber @ react-dom-client.development.js:12441
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12434
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12444
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12434
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12434
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12434
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12434
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12557
recursivelyTraversePassiveMountEffects @ react-dom-client.development.js:12415
commitPassiveMountOnFiber @ react-dom-client.development.js:12453
flushPassiveEffects @ react-dom-client.development.js:15795
flushPendingEffects @ react-dom-client.development.js:15760
performSyncWorkOnRoot @ react-dom-client.development.js:16286
flushSyncWorkAcrossRoots_impl @ react-dom-client.development.js:16137
flushSpawnedWork @ react-dom-client.development.js:15664
commitRoot @ react-dom-client.development.js:15390
commitRootWhenReady @ react-dom-client.development.js:14643
performWorkOnRoot @ react-dom-client.development.js:14566
performWorkOnRootViaSchedulerTask @ react-dom-client.development.js:16274
performWorkUntilDeadline @ scheduler.development.js:45

Current vs. Expected behavior

The expected behavior is to not see an error. The current behavior is that HMR does not work.
This does not happen in 15.2.1, it does in 15.2.2 and 15.2.3.

Provide environment information

Mac OS, 15.3.1 
Mac Mini M4
Node 22.11.0
Latest Chrome

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

v15.2.2-canary.2 is good
v15.2.2-canary.3 is bad

My first suspect would be #76960 given the reference to HMR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions