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

Mitigate msw http middleware failure #1686

Merged
merged 2 commits into from
Jul 20, 2023
Merged

Mitigate msw http middleware failure #1686

merged 2 commits into from
Jul 20, 2023

Conversation

zephraph
Copy link
Contributor

Fixes #1681

Based on mswjs/http-middleware#27 it seems like the easiest fix is to added strict-event-emitter as an explicit dependency. I'm still digging into exactly what's happening. strict-event-emitter is pre-1.0.0 so every minor change could technical be breaking. It could be that there are version conflicts.

@vercel
Copy link

vercel bot commented Jul 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Jul 20, 2023 2:27pm

@zephraph
Copy link
Contributor Author

> npm why strict-event-emitter

strict-event-emitter@0.2.8 dev
node_modules/@mswjs/interceptors/node_modules/strict-event-emitter
  strict-event-emitter@"^0.2.4" from @mswjs/interceptors@0.17.6
  node_modules/@mswjs/interceptors
    @mswjs/interceptors@"^0.17.5" from msw@1.2.3
    node_modules/msw
      dev msw@"^1.2.2" from the root project
      peer msw@">=1.0.0" from @mswjs/http-middleware@0.8.0
      node_modules/@mswjs/http-middleware
        dev @mswjs/http-middleware@"^0.8.0" from the root project

strict-event-emitter@0.4.6 dev
node_modules/msw/node_modules/strict-event-emitter
  strict-event-emitter@"^0.4.3" from msw@1.2.3
  node_modules/msw
    dev msw@"^1.2.2" from the root project
    peer msw@">=1.0.0" from @mswjs/http-middleware@0.8.0
    node_modules/@mswjs/http-middleware
      dev @mswjs/http-middleware@"^0.8.0" from the root project

strict-event-emitter@0.5.0 dev
node_modules/strict-event-emitter
  dev strict-event-emitter@"^0.5.0" from the root project

@zephraph
Copy link
Contributor Author

More digging here...

We have a resolutions which was for yarn. Annoyingly NPM called it overrides so the resolutions field does nothing. Anyway, adding strict-event-emitter to ^0.4.0 in overrides causes @mswjs/interceptors to fail because it relies on 0.2.8 which has a different API than the 0.4.6 relied upon by msw/middleware.

@zephraph
Copy link
Contributor Author

I suspect this is the upstream PR that needs to get merged for us to be in a better place: mswjs/interceptors#382

@david-crespo
Copy link
Collaborator

So by "better place" you just mean removing the explicit dep? This doesn't seem bad at all tbh. No warnings on npm install, everything seems fine.

@david-crespo david-crespo merged commit 618455a into main Jul 20, 2023
8 checks passed
@david-crespo david-crespo deleted the fix-mock-api branch July 20, 2023 20:00
@zephraph
Copy link
Contributor Author

Yeah. The only reason we have to explicitly have the dependency is because of the downstream version conflicts. Once they fix that we can remove the dependency.

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

Successfully merging this pull request may close these issues.

npm run start:mock-api errors out
2 participants