msw icon indicating copy to clipboard operation
msw copied to clipboard

Cannot read properties of undefined (reading 'url')

Open nemonemi opened this issue 1 year ago • 2 comments

Prerequisites

Environment check

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

Browsers

Chromium (Chrome, Brave, etc.)

Reproduction repository

N/A

Reproduction steps

msw version: 2.3.0-ws.rc-7 - using it for the subscription mocking

I believe it's the same behavior and reason as described in this issue https://github.com/mswjs/msw/issues/2083. image

Current behavior

Almost every time I reload my screen, or it is auto-reloaded it throws this error.

Cannot read properties of undefined (reading 'url')

Expected behavior

Does not throw this error.

nemonemi avatar Jul 02 '24 08:07 nemonemi

This is a nasty bug. We use an error handler of last resort. When there is an unhandled exception it will tear down the application, try to send diagnostics and present a generic error message to the user.

All we can do here is check if the error message is equal to Cannot read properties of undefined (reading 'url') and pray this rather generic error was really emitted by msw.

ghost avatar Jul 31 '24 07:07 ghost

In my case, it happens only in the development mode. When it happens I simply close the React error popup and continue working. It is not super intrusive, but it would be great if it didn't occur.

nemonemi avatar Aug 07 '24 12:08 nemonemi

Looks like a duplicate of #2146. Let's track it there.

kettanaito avatar Aug 28 '24 17:08 kettanaito