Skip to content

Scaffolding cli does not correctly parse headers #314

@sbussard

Description

@sbussard

I have a graphql endpoint that is authenticated using a header.

When I pass the header in via the CLI in this fashion:

yarn mst-gql --format ts --header "[HEADER NAME]: [HEADER DATA]" [ENDPOINT URL]

It gives this error:

 ›   Error: Error initializing Apollo GraphQL project "Unnamed Project": Error:
 ›    Error in "Loading schema for Unnamed Project": Error: TypeError:  is not 
 ›   a legal HTTP header name

It appears to not correctly parse the header.

After investigating the source code, I noticed that it is using apollo under the hood to download the schema, as seen here
https://github.com/mobxjs/mst-gql/blob/main/generator/mst-gql-scaffold.js#L72.

Here is the apollo cli documentation
https://github.com/apollographql/apollo-tooling#apollo-clientdownload-schema-output

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions