apollo-ios: Error initializing Apollo GraphQL project "Unnamed Project": Error: Error in "Loading schema for Unnamed Project": TypeError: Cannot read property 'reduce' of undefined
Now using node v8.15.0 (npm v6.4.1) › Warning: apollo update available from 2.16.3 to 2.17.4. ++ npx --no-install apollo codegen:generate --target=swift '--includes=./**/*.graphql' --localSchemaFile=schema.json API.swift › Warning: apollo update available from 2.16.3 to 2.17.4. Loading Apollo Project [started] { Error: Error in "Loading schema for Unnamed Project": TypeError: Cannot read property 'reduce' of undefined at Object.error (/Users/m.fai/Desktop/Projects/dumyname/MobileApps/dumyname-ios/node_modules/@oclif/errors/lib/index.js:22:17) at Generate.error (/Users/m.fai/Desktop/Projects/dumyname/MobileApps/dumyname-ios/node_modules/@oclif/command/lib/command.js:57:23) at OclifLoadingHandler.showError (/Users/m.fai/Desktop/Projects/dumyname/MobileApps/dumyname-ios/node_modules/apollo/lib/OclifLoadingHandler.js:28:22) at OclifLoadingHandler.handle (/Users/m.fai/Desktop/Projects/dumyname/MobileApps/dumyname-ios/node_modules/apollo/lib/OclifLoadingHandler.js:13:18) at <anonymous> oclif: { exit: 2 }, code: undefined } Loading Apollo Project [failed] → Error initializing Apollo GraphQL project "Unnamed Project": Error: Error in "Loading schema for Unnamed Project": TypeError: Cannot read property 'reduce' of undefined › Error: Error initializing Apollo GraphQL project "Unnamed Project": Error: › Error in "Loading schema for Unnamed Project": TypeError: Cannot read › property 'reduce' of undefined Command /bin/sh failed with exit code 2
I am so much frustrated due to lack of documentation of Apollo ios. it has been more than a week I am trying to use graphQL in my ios app. I resolve all errors but now stuck in this one and don’t know the solution. one thing which I have noticed in this project is lack of compatibility with old and different version os required libs.
- To make it run you have to update from Xcode (swift 5).
- Than update cocoa pods gem because old cocoa pods will not download the new version of apollo pod. its weird.
- update Node because Apollo package needs it.
- etc and once you are done with all errors do pray for this library works.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 27 (22 by maintainers)
ok, I found that the schema.json was generate from web doc is wrong, so I try to download the file by command line.
it should show: apollo/2.31.1 darwin-x64 node-v12.18.3 … or something like that
Then use schema.json somewhere you want, I hope these information can help someone else
For me wrong schema downloaded. Wrong: apollo schema:download --endpoint=YOUR_SERVER_URL/graphql schema.json Right: apollo schema:download --endpoint=YOUR_SERVER_URL/query schema.json
Hey guys, it can be you have wrong schema.json and .graph files, so you should try correct file here to test: https://www.raywenderlich.com/595-getting-started-with-graphql-apollo-on-ios ZIP: graph.zip