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.13k stars 2.76k forks source link

Remote schema, forward headers issue #6847

Open sdahlbac opened 3 years ago

sdahlbac commented 3 years ago

Hasura 2.0.0-alpha.9

If I select Forward all headers from client when setting up remote schema

then if I try to run any query in the console the end result is

{
  "errors": [
    {
      "extensions": {
        "path": "$",
        "code": "remote-schema-error"
      },
      "message": "Failed reading: not a valid json value"
    }
  ]
}

and no requests goes through to the remote.

makarovivan commented 3 years ago

I have similar issue:

{
  "errors": [
    {
      "extensions": {
        "path": "$",
        "code": "remote-schema-error"
      },
      "message": "not enough input"
    }
  ]
}

It also connected to Forward all headers form client flag

It worked as designed before, but now I get this exception.. reinit of remote schema does not help.

2.0.0-alpha.9 2.0.0-alpha.10

martin-hasura commented 3 years ago

Would you be able to construct a small repro of the issue so we can take a look at debugging what the cause of your problem is?

sdahlbac commented 3 years ago

@martin-hasura How would I go about doing that? (Basically, I don't know what to do/where to start)

makarovivan commented 3 years ago

In my case I figured out

  1. I have Hasura behind Kong API GW.
  2. I added 3 remote schemas
  3. I have Keycloak for OpenID / OAuth

It occurs when I add Auth plugin in Kong to secure Hasura. So there seems 2 different JWT Tokens in headers, and it leads to such exception.

When I disabled security to Hasura it worked.

But anyway - error message is not helpful. And debug level logs are also empty

@martin-hasura can you advise best practice in my case, if I want to secure Hasura?

coco98 commented 3 years ago

Labeling this as a bug so that we can improve logging to capture these scenarios better.