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

2.34.0: Cannot find module 'graphql/validation/rules/UniqueTypeNames' when generating code from a graph introspection #2665

Open
jcollum-nutrien opened this issue Oct 24, 2022 · 0 comments

Comments

@jcollum-nutrien
Copy link

This is the blog post I'm using. Something is probably outdated / missing: https://www.apollographql.com/blog/tooling/apollo-codegen/typescript-graphql-code-generator-generate-graphql-types/

Intended outcome:

I'd like to generate TS types for my graph.

Actual outcome:

 ✗ cat package.json | grep -E "graph|apo"
    "@types/graphql": "14.5.0",
    "apollo": "2.34.0"
    "graphql": "16.6.0"

✗ npx rover --output json graph introspect https://graphql.dev.nutriendata.com > schemas/hub-api-dev.json

✗ npx apollo codegen:generate --localSchemaFile=schemas/hub-api-dev.json --target=typescript --tagName=gql
    Error: Cannot find module 'graphql/validation/rules/UniqueTypeNames'
    Require stack:
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@apollo/federation/dist/composition/rules.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@apollo/federation/dist/composition/compose.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@apollo/federation/dist/composition/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@apollo/federation/dist/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo-language-server/lib/providers/schema/file.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo-language-server/lib/providers/schema/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo-language-server/lib/project/base.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo-language-server/lib/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo/lib/commands/client/codegen.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@oclif/config/lib/plugin.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@oclif/config/lib/config.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@oclif/config/lib/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@oclif/command/lib/command.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/@oclif/command/lib/index.js
    - /Users/justin.collum2@nutrien.com/work/gql-gen/node_modules/apollo/bin/run
    Code: MODULE_NOT_FOUND

How to reproduce the issue:

Difficult to do as I don't know what part of our (large) graph is the actual issue here.

We have 2 graphs, this error occurred on both of them.

The schema file looks correct to me:

{"data":{"introspection_response":"schema {\n  query: Query\n  mutation: Mutation\n}\nscalar AWSDateTime\ [redacted...]

Versions

 ✗ cat package.json | grep -E "graph|apo"
    "@types/graphql": "14.5.0",
    "apollo": "2.34.0"
    "graphql": "16.6.0"
 ✗ npx apollo --version
apollo/2.34.0 darwin-x64 node-v14.19.2
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

No branches or pull requests

1 participant