hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.14k stars 2.76k forks source link

Missing 'Authorization' or 'Cookie' header in JWT authentication mode #9818

Open Prabhdeep-Singh24 opened 1 year ago

Prabhdeep-Singh24 commented 1 year ago

Version Information

Server Version: CLI Version (for CLI related issue):

hasura/graphql-engine:v2.9.0

Environment

Cloud/EKS

What is the current behaviour?

I am trying to set up subscriptions using the apollo client but I keep getting

My Apollo client config: const wsLink = new GraphQLWsLink( createClient({ url: getGraphqlUrl(true), options: { lazy: true, reconnect: true, connectionParams: async () => { const token = await getIdToken(); return { authorization: token ?Bearer ${token}: "", }; }, }, }) );

My jwl_url: { "claims_format": "stringified_json", "jwk_url": "https://cognito-idp.us-west-2.amazonaws.com/POOLID/.well-known/jwks.json", "type": "RS256", "header": {"type": "Authorization"}}

Get the following error in my Hasura Pod: Missing 'Authorization' or 'Cookie' header in JWT authentication mode When I hit my wss endpoint.

What is the expected behaviour?

I should be able to query my DB using websockets and keep connection alive.

How to reproduce the issue?

Screenshots or Screencast

Please provide any traces or logs that could help here.

Any possible solutions/workarounds you're aware of?

Keywords

tirumaraiselvan commented 1 year ago

What does ${token} resolve to? Can you print/log it in your client code to see it's actually getting it?