-
-
Notifications
You must be signed in to change notification settings - Fork 533
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 + NextJS 12+ : doesn't intercept first request, waitUntilReady not working #1474
Comments
Hey, @watch-janick. Thanks for reporting this. May I ask you to try using What I think happens now is this:
I'd suggest trying to require those Please give this a try and let me know. |
@kettanaito Awesome, it's working now 🚀 Thank you very much! 🙏 |
I wonder if we should propose this change to the Next example. This race condition can bite in some cases. |
I've reported this in the Next repo: vercel/next.js#43284. |
Hey @kettanaito thanks for the solution! Using error - unhandledRejection: Error [ERR_UNSUPPORTED_DIR_IMPORT]:
Directory import '/Users/sreejitde/dev/ethereal/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'
is not supported resolving ES modules imported from
/Users/sreejitde/dev/ethereal/node_modules/msw/lib/node/index.mjs
Did you mean to import @mswjs/interceptors/lib/interceptors/ClientRequest/index.js? sorry if this is a silly question, but is this expected? if not, how to get rid of this? |
Hi! I was using the require and it was not working in firefox. It works using incognito chrome and incognito firefox. I need to disable the react-query queries until service worker has been mounted.
|
Prerequisites
Environment check
msw
versionBrowsers
Chromium (Chrome, Brave, etc.), Firefox, Safari
Reproduction repository
https://github.com/watch-janick/msw-nextjs12-issue
Reproduction steps
yarn install
yarn dev
http://localhost:3000
in your browserCurrent behavior
Right now MSW isn't intercepting the first request.
Expected behavior
The first request should be delayed until MSW is ready according to
waitUntilReady
.The text was updated successfully, but these errors were encountered: