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

throw better error message when remote schema fails to load

Open njaremko opened this issue 4 years ago • 12 comments

After upgrading to 1.2.2 I'm unable to add a remote schema (either with imported metadata, or adding through the console)

Here's the relevant metadata:

"remote_schemas": [
        {
            "name": "laravel-schema",
            "definition": {
                "url_from_env": "DEV_PORTAL_GRAPHQL_ENDPOINT",
                "timeout_seconds": 60,
                "headers": [
                    {
                        "value": "application/json",
                        "name": "Accept"
                    }
                ],
                "forward_client_headers": true
            }
        }
    ],
{"type":"metadata","timestamp":"2020-06-01T14:30:26.993+0000","level":"warn","detail":{"message":"Inconsistent Metadata!","info":{"objects":[{"definition":{"definition":{"timeout_seconds":60,"headers":[{"value":"application/json","name":"Accept"}],"url_from_env":"DEV_PORTAL_GRAPHQL_ENDPOINT","forward_client_headers":true},"name":"laravel-schema","comment":null},"reason":"Error in $: key \"data\" not found","type":"remote_schema"}]}}}

njaremko avatar Jun 01 '20 14:06 njaremko

This issue magically went away a couple hours later (with no changes to either my schema or the two Hasura schemas)...which is a little troubling, but I'll take the win. I'll leave this open in case someone at Hasura want's to take a look.

njaremko avatar Jun 02 '20 15:06 njaremko

This issue was affecting everyone on my team. It doesn't seem to happen when exporting and loading metadata through the cli tool, only when exporting and importing metadata through the console UI.

Needless to say, we're all using the CLI tool now, but probably a good idea to look into what's causing this.

njaremko avatar Jun 03 '20 23:06 njaremko

The error "reason":"Error in $: key \"data\" not found" indicates that the introspection result (that Hasura performs when adding/reloading remote schema) did not succeed. This typically happens when the remote schema is down, network failures, timeouts and so on.

If you are noticing this consistently only in the console, then it's very strange and might require a repro for us to look at.

tirumaraiselvan avatar Jun 04 '20 03:06 tirumaraiselvan

Hmm, I'll get my team to do some more testing, but that could have been the reason.

This definitely needs a better error message :)

njaremko avatar Jun 04 '20 17:06 njaremko

Changing the title to reflect the same.

tirumaraiselvan avatar Jun 05 '20 04:06 tirumaraiselvan

We are experiencing similar issue. We have existing remote schema added, however, the following error appears on console intermittently - "GraphQL Engine metadata is inconsistent with database". ... ... Reason: "HTTP exception occurred while sending the request to http://<IP address>:8080/v1/graphql

Any idea about the real reason of this issue? we are currently on v1.3.3

image

milorad2020 avatar Apr 19 '21 07:04 milorad2020

Just to complement that to me the problem of this "reason":"Error in $: key \"data\" not found" was that I was not passing the header with the hasura password of the remote schema, in case it helps anyone

cleivson avatar Jun 09 '21 23:06 cleivson

@cleivson do you mean that you added the remote instance's HASURA_GRAPHQL_ADMIN_SECRET as part of the Additional headers when you create the remote schema? I am doing that but still getting the same error.

manos-korakakis avatar Feb 17 '22 14:02 manos-korakakis

HASURA_GRAPHQL_ADMIN_SECRET

it doesn't help.. with all of the releses

abushak avatar Feb 26 '22 05:02 abushak

@manos-korakakis @abushak most APIs won't return an introspection query (that's the query you need to get all available fields) without an Authorization-Header. This Error generally indicates, that the introspection query failed. It's generally a good idea to ask specific questions to your error-case on StackOverflow rather than GitHub. If you provide more information on your specific use-case and your setup, one might be able to help 😃

bastianwegge avatar Apr 14 '22 09:04 bastianwegge

Thank you @bastianwegge. That was indeed the case for us at least - the Authorization header.

manos-korakakis avatar Apr 19 '22 13:04 manos-korakakis

If you are not using it with auth webhook, or you have simply base level authentication i.e. hasura admin secret, then you need to pass that x-hasura-admin-secret header with your env value in to Additional headers section in remote schema form.

meetzaveri avatar Sep 12 '22 21:09 meetzaveri