Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "error: GraphQL schema file should contain a valid GraphQL introspection query result" after apollo schema:download

So I set up the graphql server described here

Now, I want to generate android queries against this server using apollo android as per these instructions.

I've tried different folder configurations for the location of the generated schema against this sample server and no matter what I do I get an error at compile time saying "GraphQL schema file should contain a valid GraphQL introspection query result"

Any advice?

like image 204
Senkwe Avatar asked Jul 25 '18 18:07

Senkwe


People also ask

What is introspection in Apollo GraphQL?

GraphQL introspection enables you to query a GraphQL server for information about the underlying schema. This includes data like types, fields, queries, mutations, and even the field-level descriptions.

Is GraphQL introspection a vulnerability?

Having GraphQL introspection in production is usually not considered a vulnerability by itself. Sometimes it makes sense to have it if the API is public and is meant to be used by developers outside of your organization. For private APIs, however, it might expose sensitive information and expand the attack surface.

How does GraphQL introspection work?

Due to its strong type system, GraphQL gives you the ability to query and understand the underlying schema. Thus, the Introspection feature allows you to query the schema and discover the available queries, mutations, subscriptions, types and fields in a specific GraphQL API.

What is GraphQL schema file?

Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields that are populated from your back-end data stores. The schema also specifies exactly which queries and mutations are available for clients to execute.


1 Answers

Turns out the solution is to use the apollo-codegen cli command and not apollo schema:download

like image 193
Senkwe Avatar answered Oct 30 '22 18:10

Senkwe