Search code examples
graphqlcommand-line-interfaceschemaapollohasura

How to download a GraphQL schema?


I am running an Apollo CLI command to obtain the schema from my Hasura endpoint.

apollo schema:download --header 'X-Hasura-Admin-Secret: <my secret>' --endpoint https://sample-backend-for-hasura-tutorial.hasura.app/v1/graphql schema.json

It fails with

  √ Loading Apollo Project
  × Saving schema to schema.json
    → TypeError:  is not a legal HTTP header name
    Error: TypeError:  is not a legal HTTP header name

I have tried various variations of the incantation, but all return the same error.

Any ideas would be greatly appreciated. :-)


Solution

  • My best guess would be to replace ' with double quotations use something like

    apollo schema:download --header="X-Hasura-Admin-Secret: <my secret>" --endpoint https://sample-backend-for-hasura-tutorial.hasura.app/v1/graphql schema.json