msw icon indicating copy to clipboard operation
msw copied to clipboard

MSW mock server not handling `secureConnect`

Open juicemia opened this issue 4 months ago • 1 comments

Prerequisites

Environment check

  • [x] I'm using the latest msw version
  • [x] I'm using Node.js version 20 or higher

Node.js version

v22.13.1

Reproduction repository

https://github.com/juicemia/repro-msw-secureconnect-issue

Reproduction steps

pnpm i
pnpm test

Current behavior

The secureConnect event is not being correctly handled. HTTP requests made using the NodeHttpClient in the reproduction repository will hang indefinitely.

Expected behavior

I expected HTTP requests made using the NodeHttpClient in the reproduction repository to complete successfully.

juicemia avatar Aug 15 '25 19:08 juicemia

I opened https://github.com/mswjs/interceptors/pull/745 that makes the tests in the reproduction repo all pass when I use it in place of the upstream.

To do this I added an override for pnpm to use my local copy of the interceptors package:

    "pnpm": {
      "overrides": {
      "@mswjs/interceptors": "file:/path/to/local/projects/juicemia/mswjs-interceptors"
    }

I then built the interceptors package using pnpm build and installed it in the reproduction repo by removing node_modules and running pnpm i again.

juicemia avatar Aug 21 '25 20:08 juicemia