epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.63k stars 376 forks source link

[MSW] Warning: intercepted a request without a matching request handler: #549

Closed Joseamica closed 11 months ago

Joseamica commented 11 months ago

Im using this stack for my main project, but when I use fetch I get a bunch of warnings, around 10x this message:

Read more: https://mswjs.io/docs/getting-started/mocks
GET /dashboard/tables?_data=routes/dashboard+/tables 200 - - 118.309 ms
GET /dashboard/tables?_data=root 200 - - 6.871 ms
[MSW] Warning: intercepted a request without a matching request handler:

  • GET https://av.fly.dev/api/clmp0brnr000dq39v4379wyp0/tables

If you still wish to intercept this unhandled request, please create a request handler for it.
Read more: https://mswjs.io/docs/getting-started/mocks
GET /dashboard/tables?_data=routes/dashboard+/tables 200 - - 91.385 ms
[MSW] Warning: intercepted a request without a matching request handler:

  • GET https://av.fly.dev/api/clmp0brnr000dq39v4379wyp0/tables

If you still wish to intercept this unhandled request, please create a request handler for it.
Read more: https://mswjs.io/docs/getting-started/mocks
GET /dashboard/tables?_data=root 200 - - 12.040 ms
GET /dashboard/tables?_data=routes/dashboard+/tables 200 - - 108.198 ms
GET /dashboard/tables?_data=root 200 - - 12.283 ms
[MSW] Warning: intercepted a request without a matching request handler:

  • GET https://av.fly.dev/api/clmp0brnr000dq39v4379wyp0/tables

If you still wish to intercept this unhandled request, please create a request handler for it.
Read more: https://mswjs.io/docs/getting-started/mocks
GET /dashboard/tables?_data=routes/dashboard+/tables 200 - - 68.092 ms

Also, when i just reload the app i get a lot of get requests

GET / 200 - - 33.989 ms
GET /?_data=root 200 - - 17.430 ms
GET /?_data=root 200 - - 2.206 ms
GET /?_data=root 200 - - 3.146 ms
ananni13 commented 11 months ago

The warnings come from MSW, the mock server that is launched alongside the app server during development (see server/dev-server.js, index.js and tests/mocks/index.ts).

It intercepts all outgoing requests, and since you're making GET requests to https://av.fly.dev and you haven't defined a mock handler for that endpoint, you get the warning.

You can take a look in the mocks folder for examples on how to define handlers.

Also, when i just reload the app i get a lot of get requests

GET / 200 - - 33.989 ms GET /?_data=root 200 - - 17.430 ms GET /?_data=root 200 - - 2.206 ms GET /?_data=root 200 - - 3.146 ms

This is Remix calling loaders and revalidating data, multiple requests might be related to client-hints cookies: