Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot redefine property: Request at Function.defineProperty (<anonymous>) #2286

Closed
4 tasks done
AdrienFromToulouse opened this issue Sep 16, 2024 · 4 comments
Closed
4 tasks done
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@AdrienFromToulouse
Copy link

AdrienFromToulouse commented Sep 16, 2024

Prerequisites

Environment check

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

Node.js version

v20

Reproduction repository

https://donthavearepotoshare.com

Reproduction steps

Hi, since 2.4.4 there was this issue #2276 unfortunately the 2.4.7 version has still some issues it seems. With the error TypeError: Cannot redefine property: Request at Function.defineProperty (<anonymous>)
I think linked to: #2283

Cheers,

Current behavior

TypeError: Cannot redefine property: Request at Function.defineProperty ()

Expected behavior

No error.

@AdrienFromToulouse AdrienFromToulouse added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Sep 16, 2024
@kettanaito
Copy link
Member

Hi, @AdrienFromToulouse. Thanks for reporting this. Sadly, I cannot look into issues without a reproduction repo. Whomever encountering this also are highly encouraged to provide one. Thank you for understanding.

@rafaelji
Copy link

I'm facing the same problem! Couldn't find a solution 😞

@jcrang
Copy link

jcrang commented Sep 16, 2024

For us this was an issue with the recommended Jest polyfills.

We've resolved this by changing the recommended Jest polyfills to make Request and Reponse configurable.

PR for the docs change mswjs/mswjs.io#416

@AdrienFromToulouse
Copy link
Author

For us this was an issue with the recommended Jest polyfills.

We've resolved this by changing the recommended Jest polyfills to make Request and Reponse configurable.

PR for the docs change mswjs/mswjs.io#416

Many thanks for pointing that out @jcrang works like a charm now 🙏

@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node
Projects
None yet
Development

No branches or pull requests

4 participants