graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Troubles with connectionParams on subscriptions

Open Jhomalex opened this issue 1 year ago • 0 comments

Hello I'm having troubles with connectionParams.

I have a server with support to queries, mutations and subscriptions. It works fine, but when I tried to use with graphql-mesh, it send to my server bad connectionParams. Most exactly I'm receiving this string on Authorization connectionParam: "{context.headers['authorization']}" (the graphql-mesh don't recognize the variables and send me the string of the yaml file)

My setup of .yaml file is more or less like that:

...
handler:
      graphql:
          endpoint: ${CHATS_ENDPOINT}
          subscriptionsEndpoint: ${CHATS_SUBSCRIPTIONS_ENDPOINT}
          subscriptionsProtocol: WS
          operationHeaders:
                    Authorization: "{context.headers['authorization']}"
          connectionParams:
                    Authorization: "{context.headers['authorization']}"
      multipart: true
...

I tried too use "{context.connectionParams['authorization']}" instead.

I'm using these dependencies on the server with graphql-mesh (all is updated to the newest version):

{
    "@graphql-mesh/cli": "0.88.4",
    "@graphql-mesh/graphql": "0.96.2",
    "@graphql-mesh/runtime": "0.97.3",
    "@graphql-mesh/store": "0.96.2",
    "@graphql-mesh/utils": "0.96.2",
    "graphql": "15.8.0"
  }

I have tested that on Windows 11 with node.js 18.15.0 and on Debian with node.js 18.15.0

Jhomalex avatar Dec 17 '23 04:12 Jhomalex