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

MSW example not working #348

Closed
SylRob opened this issue Sep 25, 2023 · 2 comments
Closed

MSW example not working #348

SylRob opened this issue Sep 25, 2023 · 2 comments

Comments

@SylRob
Copy link

SylRob commented Sep 25, 2023

The MSW example seem to not be working anymore.

This error appear in the front and on the server when we try to reach the home page after running

npm run dev
Application Error

FetchError: request to https://my-mock-api.com/ failed, reason: response3.headers.all is not a function
    at NodeClientRequest.<anonymous> (/****/examples/msw/node_modules/@remix-run/web-fetch/src/fetch.js:112:11)
    at NodeClientRequest.emit (node:events:517:28)
    at NodeClientRequest.emit (/****/examples/msw/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/NodeClientRequest.ts:299:22)
    at /****/examples/msw/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/NodeClientRequest.ts:153:14

The codeSandbox link seem to also have the same error

BTW: my node version is v18.18.0

@SylRob SylRob changed the title MSW example fail MSW example not working Sep 25, 2023
@SylRob
Copy link
Author

SylRob commented Sep 25, 2023

I forgot to mention that I tried to initialize the service worker like MSW doc is saying :

npx msw init public/ --save

It succeeded, but the error still happens.

@machour
Copy link
Collaborator

machour commented May 30, 2024

Hey @SylRob

That problem was described in the README, as the used msw version didn't support node's fetch at that time.
I just upgraded the example to latest msw & remix version, and everything should be working fine.

Please open a new issue if you're still facing problems 🙏🏼

@machour machour closed this as completed May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants