[2.6.7] TypeError: Cannot read property 'some' of undefined
See original GitHub issueHello!
First of all, thank you all for this great tool.
I’ve noticed this morning an error message when updating to v2.6.7
.
package.json
{
"apollo-server": "^2.6.7",
"apollo-server-express": "^2.6.7",
"graphql": "^14.4.1"
}
package.json
where the issue does not occur:
{
"apollo-server": "^2.6.4",
"apollo-server-express": "^2.6.4",
"graphql": "^14.3.1"
}
Actual behavior
/Users/tom/Development/backend/node_modules/apollo-server-core/dist/utils/isDirectiveDefined.js:11
return typeDef.definitions.some(definition => definition.kind === language_1.Kind.DIRECTIVE_DEFINITION &&
^
TypeError: Cannot read property 'some' of undefined
at typeDefs.some.typeDef (/Users/tom/Development/backend/node_modules/apollo-server-core/dist/utils/isDirectiveDefined.js:11:36)
at Array.some (<anonymous>)
at Object.exports.isDirectiveDefined (/Users/tom/Development/backend/node_modules/apollo-server-core/dist/utils/isDirectiveDefined.js:7:21)
at new ApolloServerBase (/Users/tom/Development/backend/node_modules/apollo-server-core/dist/ApolloServer.js:146:39)
at new ApolloServer (/Users/tom/Development/backend/node_modules/apollo-server-express/dist/ApolloServer.js:46:9)
at Object.<anonymous> (/Users/tom/Development/backend/app/app.js:31:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/tom/Development/backend/index.js:6:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
Environment
node v8.16.0
macOS 10.14.5
One thing I noticed is that when I updated both apollo-server
and apollo-server-express
to v2.6.7
but left the graphql
package at v14.3.1
the issue is still there.
Please let me know if there’s any additional info needed that I could provide.
Thank you!
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value....
Read more >TypeError: Cannot read property 'any' of undefined React
Use version 5.3.6. It will definitely solve the problem.
Read more >Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >cannot read properties of undefined (reading 'refresh') - You.com
Your issue is that your .find() method is returning undefined , so you can't access properties on product such as .name as it...
Read more >Uncaught TypeError: Cannot read property 'html5' of undefined
Uncaught TypeError: Cannot read property 'html5' of undefined · 1. I look at the JS error (which you provided) and use a word...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same for me. It works on 2.6.1, but doesn’t work on 2.9.7
Excellent issue and great research.
We also used the
() => [Book]
type exports and this caused issues for any version after 2.6.4The correct solution IMO is to avoid this syntax for exporting types and just export types as DocumentNode or [DocumentNode, DocumentNode] and flatten them before passing them to typeDefs.