Unable to download schema using the `apollo-kotlin-cli`

Hi Team,

Since the downloadApolloSchema is deprecated, I tried using apollo-kotlin-cli v0.0.5 and v.0.04 as well.

I am seeing the following exception whenever I try to download the schema

Exception in thread "main" java.lang.IllegalStateException: Cannot get schema from https://www.devc.yelp.com/__dev__/graphql: 500:
{"errors":[{"message":"Cannot query field \"isOneOf\" on type \"__Type\".","extensions":{"code":"INVALID_GRAPHQL","stacktrace":["GraphQLError: Cannot query field \"isOneOf\" on type \"__Type\".","    at Object.err (/code/node_modules/@apollo/federation-internals/src/error.ts:36:60)","    at validate (/code/node_modules/@apollo/federation-internals/src/operations.ts:63:34)","    at selectionOfNode (/code/node_modules/@apollo/federation-internals/src/operations.ts:3894:7)","    at selectionSetOfNode (/code/node_modules/@apollo/federation-internals/src/operations.ts:3867:20)","    at /code/node_modules/@apollo/federation-internals/src/operations.ts:3972:34","    at Array.forEach (<anonymous>)","    at operationFromDocument (/code/node_modules/@apollo/federation-internals/src/operations.ts:3968:24)","    at /code/node_modules/@apollo/gateway/src/index.ts:803:58","    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)","    at AsyncLocalStorageContextManager.with (/code/node_modules/@opentelemetry/context-async-hooks/src/AsyncLocalStorageContextManager.ts:40:36)"]}}]}

        at com.apollographql.apollo.tooling.SchemaHelper.fetch(SchemaHelper.kt:63)
        at com.apollographql.apollo.tooling.SchemaHelper.executeIntrospectionQuery$apollo_tooling(SchemaHelper.kt:104)
        at com.apollographql.apollo.tooling.SchemaDownloader.downloadIntrospection(SchemaDownloader.kt:150)
        at com.apollographql.apollo.tooling.SchemaDownloader.download(SchemaDownloader.kt:62)
        at com.apollographql.cli.DownloadSchemaCommand.run(DownloadSchemaCommand.kt:34)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:198)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:18)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:400)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:397)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:415)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:440)
        at com.apollographql.cli.MainKt.main(Main.kt:55)

The command used by me
./apollo-kotlin-cli download-schema --endpoint="https://www.some.internal.endpoint.com/__dev__/graphql" --schema="~/Desktop/schema_11223.json"
Any suggestions?

Hi!

Can you execute this query on your server, and see if there is a field named oneOf in the response?

query ExampleQuery {
  __type(name: "__Type") {
    fields {
      name
    }
  }
}

If yes, then it should be possible to query this field, and the error from the server is a probable bug on that side.

Hi @Benoit_Lubek
While there isn’t a field named oneOf there is however one names isOneOf.
Could that be an issue?

Yes sorry that’s what I meant, isOneOf. Since it is listed in the fields of __Type, it should be allowed to select it in this query without resulting in an error:

query ExampleQuery {
  __schema {
    types {
      isOneOf
    }
  }
}

Can you bring this to the attention of people in charge of the server?

1 Like