apollo-ios: TypeError: Cannot read property 'getQueryType' of undefined
Using Apollo pod (0.9.4)
Xcode 10.1
iOS 12.1
Integrated as per https://www.apollographql.com/docs/ios/installation.html
:-1: › Warning: apollo update available from 1.9.2 to 2.1.6
:-1: ++ npx --no-install apollo codegen:generate '--queries=./Apollo/GetProfile.graphql
:-1: ./Apollo/GetLoyaltyDetails.graphql
:-1: ./Apollo/GetEmail.graphql' --schema=schema.json API.swift
:-1: › Warning: apollo update available from 1.9.2 to 2.1.6
:-1: [16:48:00] Loading Apollo config [started]
:-1: [16:48:00] Loading Apollo config [completed]
:-1: [16:48:00] Resolving GraphQL document sets and dependencies [started]
:-1: [16:48:00] Scanning for GraphQL queries (3 found) [title changed]
:-1: [16:48:00] Scanning for GraphQL queries (3 found) [completed]
:-1: [16:48:00] Generating query files [started]
:-1: [16:48:00] Generating query files with 'swift' target [title changed]
:-1: [16:48:00] Generating query files with 'swift' target [failed]
:-1: [16:48:00] → Cannot read property 'getQueryType' of undefined
:-1: TypeError: Cannot read property 'getQueryType' of undefined
:-1: at TypeInfo.enter (~/project/ios/node_modules/graphql/utilities/TypeInfo.js:142:25)
:-1: at Object.enter (~/project/ios/node_modules/graphql/language/visitor.js:363:16)
:-1: at Object.visit (~/project/ios/node_modules/graphql/language/visitor.js:254:26)
:-1: at getValidationErrors (~/project/ios/node_modules/apollo/lib/validation.js:21:15)
:-1: at Object.validateQueryDocument (~/project/ios/node_modules/apollo/lib/validation.js:26:30)
:-1: at Object.generate [as default] (~/project/ios/node_modules/apollo/lib/generate.js:19:18)
:-1: at Task.task (~/project/ios/node_modules/apollo/lib/commands/codegen/generate.js:98:64)
:-1: at Promise.resolve.then.then.skipped (~/project/ios/node_modules/listr/lib/task.js:167:30)
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
But I got the same issue.
Please advise!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 9
- Comments: 16 (6 by maintainers)
To expand on @mlomeli’s comment- I was also getting this error until I moved
schema.json
into the project source files directory (where the AppDelegate file is located, not where *.xcodeproj resides).Me three. Nvm, my Schema.json was in the wrong place. However I think the debugging information could be better.