Closed
Description
Is there a way to pass API Key via query parameters without having to create a resolver myself?
Here is a sandbox as example: https://codesandbox.io/s/angry-goldwasser-qsen0
If you run the example graphql query from above, you'll get a 401 (unauthorized) because qs
parameters are not being added to the REST request.
In the same sandbox, if you try to generate the sdk by running yarn generate-sdk ./out.ts
you get the error bellow.
I didn't investigate the issue in detail, but could be related to something similar to this post.
TypeError: Cannot read property 'length' of undefined
at hasConditionalDirectives (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:479:20)
at transformed._processor.transformPrimitiveFields.Array.from.map.field (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2597:32)
at Array.map (<anonymous>)
at SelectionSetToObject.buildSelectionSetString (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2596:112)
at getPossibleTypes.reduce (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2527:41)
at Array.reduce (<anonymous>)
at SelectionSetToObject._buildGroupedSelections (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2517:80)
at SelectionSetToObject.transformSelectionSet (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2637:30)
at SelectionSetToObject.buildSelectionSetString (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2590:89)
at getPossibleTypes.reduce (/sandbox/node_modules/@graphql-codegen/visitor-plugin-common/index.cjs.js:2527:41)