-
Notifications
You must be signed in to change notification settings - Fork 2k
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.6.0] TypeError: Cannot read property 'some' of undefined #2753
Comments
Hey @wKovacs64, thanks for taking the time to report your issue. Based on the typings for a export interface DocumentNode {
readonly kind: "Document";
readonly loc?: Location;
readonly definitions: ReadonlyArray<DefinitionNode>;
} In the glitch you provided, you're passing a string as By passing that string into const server = new ApolloServer({
typeDefs: gql`${typeDefs}`,
resolvers
}); I'm fairly certain this should resolve the issue, but if not, please feel free to reopen. Thanks again! |
@abernix and I have discussed this a bit and recognize it as an unintended breaking change. We're working on a patch to reintroduce support for |
Fixed in 2.6.1 (#2754), thanks to the both of you! 🚀 |
Thank you! |
Bump this issue for latest 2.6.6 Passing |
Hi! I'm getting the same error and it's wrapped in |
@mg9101 can you please provide a runnable reproduction for us? Also if you're able, please make sure your server is running the latest version. Thanks! |
@trevor-scheer I am also facing the same TypeError even after wrapping in
|
Finally... I got it to work after making this changes: https://stackoverflow.com/questions/64285400/error-when-building-typedefs-typeerror-cannot-read-property-some-of-undefined/64288307#64288307 |
Description
Just tried to update
apollo-server-express
from 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
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 alltypeDef
objects have adefinitions
property, or isundefined
valid?).packages/apollo-server-core/src/utils/isDirectiveDefined.ts#L8
The code indicates
typeDef
is of typeDocumentNode
fromgraphql/language
but I didn't seeDocumentNode
in the exported type definitions and ran out of time to chase that further. ¯\_(ツ)_/¯The text was updated successfully, but these errors were encountered: