Search code examples
iosgraphqlapolloapollo-client

Apollo iOS client code generation: "Error: Cannot query field"


I'm trying to generate code following this steps using cocoa pods. On step: 5. Setup and run code generation using appolo-ios-cli generate command I'm getting this error:

 Error: Cannot query field "getAuthServiceHealth" on type "undefined"
 ./../NetworkInterface/GraphQL/QueriesList.graphql:2:2
1 | query Health {
2 |     getAuthServiceHealth{
  |  ^
3 |         status

Queries.graphql:

query Health {
    getAuthServiceHealth{
        status
        service
    }
}

schema:

{
  "__schema": {
    "queryType": {
      "name": "Query"
    },
    "mutationType": null,
    "subscriptionType": null,
    "types": [
      {
        "kind": "OBJECT",
        "name": "Query",
        "description": null,
        "fields": [
          {
            "name": "getAuthServiceHealth",
            "description": null,
            "args": [],
            "type": {
              "kind": "NON_NULL",
              "name": null,
              "ofType": {
                "kind": "OBJECT",
                "name": "HealthResponse",
                "ofType": null
              }
            },
            "isDeprecated": false,
            "deprecationReason": null
          },

Why I'm getting this error?

Thanks


Solution

  • Resolved: I have done what was discussed on this thread: https://github.com/apollographql/apollo-ios/issues/2543#issuecomment-1280466644