Description
Just tried to update apollo-server-express from 2.5.1 → 2.6.0 but it's failing with the following:
TypeError: Cannot read property 'some' of undefined
61 |
> 62 | const apolloServer = new ApolloServer({
| ^
at typeDefs.some.typeDef (node_modules/apollo-server-core/src/utils/isDirectiveDefined.ts:8:25)
at Array.some (<anonymous>)
at Object.<anonymous>.exports.isDirectiveDefined (node_modules/apollo-server-core/src/utils/isDirectiveDefined.ts:7:12)
at new ApolloServerBase (node_modules/apollo-server-core/src/ApolloServer.ts:275:12)
at new ApolloServer (node_modules/apollo-server-express/src/ApolloServer.ts:84:5)
It appears this only happens when importing typeDefs from an SDL file.
Reproduction
Glitch Remix (see server.js line 5, and open the logs)
Hacky Workaround
I modified isDirectiveDefined locally to include a truthiness check and that works, but I'm not sure if that's a real fix or just masking an actual problem (e.g. should all typeDef objects have a definitions property, or is undefined valid?).
packages/apollo-server-core/src/utils/isDirectiveDefined.ts#L8
typeDefs.some(typeDef =>
- typeDef.definitions.some(
+ typeDef.definitions && typeDef.definitions.some(
definition =>
The code indicates typeDef is of type DocumentNode from graphql/language but I didn't see DocumentNode in the exported type definitions and ran out of time to chase that further. ¯\_(ツ)_/¯
Description
Just tried to update
apollo-server-expressfrom 2.5.1 → 2.6.0 but it's failing with the following:It appears this only happens when importing typeDefs from an SDL file.
Reproduction
Glitch Remix (see server.js line 5, and open the logs)
Hacky Workaround
I modified
isDirectiveDefinedlocally to include a truthiness check and that works, but I'm not sure if that's a real fix or just masking an actual problem (e.g. should alltypeDefobjects have adefinitionsproperty, or isundefinedvalid?).packages/apollo-server-core/src/utils/isDirectiveDefined.ts#L8
The code indicates
typeDefis of typeDocumentNodefromgraphql/languagebut I didn't seeDocumentNodein the exported type definitions and ran out of time to chase that further. ¯\_(ツ)_/¯