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

ERROR: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule' #904

Closed
robross0606 opened this issue Jul 23, 2021 · 8 comments · Fixed by #913
Closed

ERROR: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule' #904

robross0606 opened this issue Jul 23, 2021 · 8 comments · Fixed by #913
Assignees

Comments

@robross0606
Copy link

robross0606 commented Jul 23, 2021

Receiving the following error when upgrading to v0.27.0:

  Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule' from 'node_modules/@apollo/federation/dist/composition/validate/preNormalization/tagDirective.js'

    Require stack:
      node_modules/@apollo/federation/dist/composition/validate/preNormalization/tagDirective.js
      node_modules/@apollo/federation/dist/composition/validate/preNormalization/index.js
      node_modules/@apollo/federation/dist/composition/validate/index.js
      node_modules/@apollo/federation/dist/composition/composeAndValidate.js
      node_modules/@apollo/federation/dist/composition/index.js
      node_modules/@apollo/federation/dist/index.js
      src/graphql/index.js
@robross0606
Copy link
Author

robross0606 commented Jul 23, 2021

This is purely at the module require() level. I have tried with both Windows and Linux.

node: v14.17.3
npm: 6.14.12

Reverting back to v0.25.2 or even v0.26.0 eliminates the issue.

@robross0606
Copy link
Author

This appears to also have been resolved by upgrading from apollo-server v2.25.2 to v3.0.2. However, the dependencies do not declare this as a requirement and it would seems strange that a minor (non-breaking) version increment should require a major (breaking) dependency.

@glasser
Copy link
Member

glasser commented Jul 23, 2021

It looks like this internal "export" from graphql-js was renamed in graphql@15: graphql/graphql-js#2448

That means that the packages in this repo claim to support (via peer deps) graphql@14 and graphql@15 but now only support graphql@15.

Apollo Server 3 only supports graphql@15, so doing that upgrade had the side effect of fixing it for you.

federation and gateway are still pre-1.0 and it would probably be reasonable to change their peer dependencies to require graphql@15, but that should certainly be a documented explicit choice rather than unintentional like in this case.

cc @trevor-scheer

@trevor-scheer
Copy link
Member

My initial reaction was to fix this in a backwards compatible way via some require / fallback logic, but it looks like we've introduced at least one other GraphQL-15-only ism so my inclination is to just require v15+ in the peer dependencies rather than try to disentangle the recent work which depends on v15.

@robross0606
Copy link
Author

just require v15+ in the peer dependencies

My only issue there is that this no longer feels like a minor point release.

@trevor-scheer
Copy link
Member

You're not wrong about this being a breaking change, however semver pre-1.0 doesn't follow this convention.
https://semver.org/#spec-item-4

Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

We do tend to stick to not breaking anything in patch releases, but we do not consider this to be 1.0 yet and as such, the minor captures both breaking changes as well as new behavior.

I apologize for any inconvenience this causes.

@robross0606
Copy link
Author

Okay, fair enough.

@trevor-scheer
Copy link
Member

It's worth mentioning that npm respects this pre-1.0 convention as well and treats minors as majors. For example, the constraint ^0.27.0 will prevent npm update from taking you to 0.28.0+. Hope this helps!

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 a pull request may close this issue.

3 participants