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

GQL causes TypeError: "Cannot read properties of undefined (reading 'name')" #85

Open
sam-super opened this issue Nov 25, 2022 · 2 comments

Comments

@sam-super
Copy link

This query was in some logs:

mutation { 
  __typename 
}

which caused:

TypeError: Cannot read properties of undefined (reading 'name')\n    at QueryComplexity.nodeComplexity (/app/node_modules/graphql-query-complexity/dist/cjs/QueryComplexity.js:105:46
@ivome
Copy link
Collaborator

ivome commented Dec 14, 2022

Are mutations configured in the schema of the GraphQL server? Might be the same issue as this one: #84

@abjrcode
Copy link

We are having the same (similar) issue. Even if the operation is defined in GraphQL schema but you don't give your actual query a name then it will issue the type error.

For example:

mutation {
	doSomething(input: { amount: 1 }) {
		result
	}
}

will error but

mutation myOperation {
	doSomething(input: { amount: 1 }) {
		result
	}
}

will not.

We are on Apollo 3 and GraphQL (graphql package) 15

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

3 participants