apollo-ios: Cannot read property 'getMutationType' of undefined
Now using node v8.15.0 (npm v6.4.1)
› Warning: apollo update available from 1.9.2 to 2.1.8
++ npx --no-install apollo codegen:generate '--queries=./services/graphQl/CreateNewPost.graphql
./services/graphQl/DeletePost.graphql
./services/graphQl/GetComments.graphql
./services/graphQl/PostComments.graphql
./services/graphQl/UpdatePost.graphql' --schema=schema.json API.swift
› Warning: apollo update available from 1.9.2 to 2.1.8
[12:43:55] Loading Apollo config [started]
[12:43:55] Loading Apollo config [completed]
[12:43:55] Resolving GraphQL document sets and dependencies [started]
[12:43:55] Scanning for GraphQL queries (5 found) [title changed]
[12:43:55] Scanning for GraphQL queries (5 found) [completed]
[12:43:55] Generating query files [started]
[12:43:55] Generating query files with 'swift' target [title changed]
[12:43:55] Generating query files with 'swift' target [failed]
[12:43:55] → Cannot read property 'getMutationType' of undefined
TypeError: Cannot read property 'getMutationType' of undefined
Getting this error i researched a bit about it and i gone through many steps as per mentioned in internet
- Moving schema.json file into the place where AppDelegate lies
sudo npm install --save graphql
Updating graphQl dependencies- And i upgraded my apollo to using
sudo npm install -g apollo@2.1.8
and i checked it apollo/2.1.8 darwin-x64 node-v10.14.2 (checked from the project root folder) sudo npm install -g apollo
upgraded into latest apollo 2.3.0- Also tried running passing --passthroughCustomScalars:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --passthroughCustomScalars --schema=schema.json API.swift
even all these steps i still getting the error , i am currently using the script from the apollo graphql ios documentation , and the version i am using is 0.9.5
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 27 (8 by maintainers)
Hi all, I think I’ve same issue here: Apollo pod version: 0.9.5
Now using node v8.15.0 (npm v6.4.1) › Warning: apollo update available from 1.9.2 to 2.5.1. ++ npx --no-install apollo codegen:generate --queries=./Test.graphql --schema=schema.json API.swift › Warning: apollo update available from 1.9.2 to 2.5.1. [17:37:18] Loading Apollo config [started] [17:37:18] Loading Apollo config [completed] [17:37:18] Resolving GraphQL document sets and dependencies [started] [17:37:18] Scanning for GraphQL queries (1 found) [title changed] [17:37:18] Scanning for GraphQL queries (1 found) [completed] [17:37:18] Generating query files [started] [17:37:18] Generating query files with ‘swift’ target [title changed] Test.graphql:3: error: Cannot query field “nodes” on type “Query”. [17:37:18] Generating query files with ‘swift’ target [failed] [17:37:18] → Validation of GraphQL query document failed ToolError: Validation of GraphQL query document failed at Object.validateQueryDocument (~/Desktop/ResearchDevelop/testApollo/node_modules/apollo/lib/validation.js:31:15) at Object.generate [as default] (~/Desktop/ResearchDevelop/testApollo/node_modules/apollo/lib/generate.js:19:18) at Task.task (~/Desktop/ResearchDevelop/testApollo/node_modules/apollo/lib/commands/codegen/generate.js:98:64) at Promise.resolve.then.then.skipped (~/Desktop/ResearchDevelop/testApollo/node_modules/listr/lib/task.js:167:30) at <anonymous>
Help 😃 ?
Wow… that was an informative article! 😅 Thanks again for your support. Now that I got it working is time to play around with Apollo. Cheers!
I removed the POD and wrote simple HTTP calls and with that parameters with the query and it’s working fine