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 + Next.js does not intercept requests after page refresh #1698

Closed
4 tasks done
khoi-fish opened this issue Aug 14, 2023 · 4 comments
Closed
4 tasks done

MSW + Next.js does not intercept requests after page refresh #1698

khoi-fish opened this issue Aug 14, 2023 · 4 comments
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@khoi-fish
Copy link

khoi-fish commented Aug 14, 2023

Prerequisites

Environment check

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

Node.js version

>= 16

Reproduction repository

https://github.com/khoi-fish/with-msw-fix/tree/fix

Reproduction steps

  1. yarn
  2. yarn dev
  3. Navigate to localhost:3000
  4. Notice that the page loads fine
  5. Hit refresh
  6. msw fails to intercept request and the page breaks

Current behavior

image

Expected behavior

The expectation is that refreshing should not break the page.

@khoi-fish khoi-fish added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Aug 14, 2023
@khoi-fish
Copy link
Author

Happy to answer any questions to further help identify the issue 🙂

@gidztech
Copy link

I ran into this issue today after updating Next.js. I played around with the different versions that have been released recently, and it seems it only started happening in v13.4.13. On prior versions, you can refresh the page and the interception works. I've not dug deeper into why yet.

@kettanaito
Copy link
Member

I'm going to close this. Next.js doesn't work well with MSW at the moment. Until I have a fully functional example as confirmation of that, Next.js is not supported.

You can follow the progress of that example here:
mswjs/examples#101

The Next.js team has also reached out to me to help address the remaining issues on Next.js side, so I hope to post some updates soon.

@SalahAdDin
Copy link

I'm going to close this. Next.js doesn't work well with MSW at the moment. Until I have a fully functional example as confirmation of that, Next.js is not supported.

You can follow the progress of that example here: mswjs/examples#101

The Next.js team has also reached out to me to help address the remaining issues on Next.js side, so I hope to post some updates soon.

It does not work at all.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 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