Not all `operationHeaders` are forwarded
keremkambur opened this issue · comments
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
- 1. The issue provides a reproduction available on
Github,
Stackblitz
or
CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure Mesh package versions under
package.json
matches yours.
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
I recently needed to forward a new custom header by listing it under the operationHeaders
section in configuration file.
To Reproduce Steps to reproduce the behavior:
It's basically nothing special, I just added a new header in configuration file. Here is the meshrc.yaml
sources:
- name: CmsApi
handler:
graphql:
endpoint: ${SOME_BASE_URL}/graphql
operationHeaders:
"x-app-name": "{context.headers['x-app-name']}"
"x-app-platform": "{context.headers['x-app-platform']}"
- name: UserApi
handler:
graphql:
endpoint: ${ANOTHER_GQL_API}/graphql
operationHeaders:
Authorization: "{context.headers.authorization}"
"auth-provider": "{context.headers['auth-provider']}"
"x-app-name": "{context.headers['x-app-name']}"
"x-app-platform": "{context.headers['x-app-platform']}"
- name: XdrApi
handler:
jsonSchema:
endpoint: ${XDR_API_BASE_URL}
operations:
- type: Query
field: xdrData
path: /xdr/playhead/account/{args.someArg}/{args.someArg2}
method: GET
responseSchema: ./xdr/json-schemas/playheadData.json
# responseTypeName: xdrData
codegen:
#Default values can be found here https://the-guild.dev/graphql/mesh/docs/guides/graphql-code-generator
skipTypename: true
flattenGeneratedTypes: false
onlyOperationTypes: false
preResolveTypes: false
namingConvention: keep
documentMode: graphQLTag
gqlImport: "@graphql-mesh/utils#gql"
enumsAsTypes: true
ignoreEnumValuesFromSchema: true
useIndexSignature: true
contextType: MeshContext
And below is what I got on server side
Expected behavior
Obtaining the defined new x-app-platform
value.
Environment:
- OS: Cloudflare Worker
@graphql-mesh/...
:"@graphql-mesh/graphql": "^0.95.2"
- NodeJS:
Additional context