Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: remote schema request from query root doesn't accept extensions #7143

Closed
ygotthilf opened this issue Jun 28, 2021 · 10 comments
Closed
Assignees
Labels
k/bug Something isn't working p/high candidate for being included in the upcoming sprint

Comments

@ygotthilf
Copy link

Hello team,

First of all, thank for your amazing solution ! More than one year in production with happy users and no problem. 馃ぉ

I have an issue with the remote schema feature. The server version is the 2.0.1. Let's take invocing_by_pk query from my remote schema.

If I run :

{
  invoice_by_pk(id: "1398") {
    id
  }
}

The Hasura server fails by returning this error :

{
  "errors": [
    {
      "extensions": {
        "path": "$",
        "code": "remote-schema-error"
      },
      "message": "Received invalid JSON value from remote"
    }
  ]
}

The remote response is :

{
  "data": {
    "invoice_by_pk": {
      "id": "1398"
    }
  },
  "extensions": {
    "tracing": {
      "version": 1,
      "startTime": "2021-06-28T16:08:35.924Z",
      "endTime": "2021-06-28T16:08:36.222Z",
      "duration": 298583777,
      "execution": {
        "resolvers": [
          {
            "path": [
              "invoice_by_pk"
            ],
            "parentType": "Query",
            "fieldName": "invoice_by_pk",
            "returnType": "invoice",
            "startOffset": 3560552,
            "duration": 294694932
          },
          {
            "path": [
              "invoice_by_pk",
              "id"
            ],
            "parentType": "invoice",
            "fieldName": "id",
            "returnType": "String!",
            "startOffset": 298360006,
            "duration": 54232
          }
        ]
      }
    }
  }
}

If I disable the tracing extension from my remote schema server (Apollo), the call succeeds.

However, I noticed extensions works when I run the query from a nested Hasura field like that :

{
  user(where: {invoicingId: { _eq: "1398"} }) {
    invoice {
      id
    }
  }
}
```

Hope it can help.

Yoann
@devinellis
Copy link

I ran into this same problem, thanks for the solution @ygotthilf. According to the Apollo Server docs, tracing:true is "an older JSON-based format" so maybe Hasura silently dropped support for it?

@AssafKr
Copy link

AssafKr commented Jul 18, 2021

Ran into the same problem

@jflambert
Copy link
Contributor

This is affecting us as well

@BenoitRanque
Copy link
Contributor

BenoitRanque commented Sep 8, 2021

I can confirm this happens whenever the remote schema response payload includes the extensions key, even if it is only an empty object. This was confirmed in 2.0.7 by responding with a payload like so:

{"data":{"version":"1.0"},"extensions":{}}

The error is very misleading, and implies the response is not valid json.

@jovermier
Copy link

Could extensions on remote schemas responses be ignored instead of throwing an error?

@aBMania
Copy link

aBMania commented Sep 10, 2021

Ran into the same problem too, i'm disabling extensions of my remote schema as a workaround.

@mattrafalko
Copy link

Downgrading to 1.3.3 is the work around we are currently using.
The extension in the JSON response we are receiving contains data crucial to our business logic, so disabling the extension was not an option for us.

Downgrading is a good option if you don't maintain the external resource and don't need to manage more than one db.

@scottrblock
Copy link

@mattrafalko what did you download to 1.3.3? I'm running into the same issue on Hasura Cloud, so trying to figure out my options.

@tirumaraiselvan tirumaraiselvan added k/bug Something isn't working p/high candidate for being included in the upcoming sprint labels Nov 8, 2021
@robx
Copy link
Contributor

robx commented Nov 9, 2021

This error seems to be from this part of the code:

applyResultCustomizer resultCustomizer <$> case JO.toList valObj of

As far as I understand, we expect the response to be either of the form [{"data": ...}] (after applying the "remote result customizer"), or {"errors": [...]}. If neither happens, we see this error.

On the basic level, we should report better errors at that location. And then there's the remote result customization which I don't know about, CC @dmoverton who appears to have been working on this.

@dmoverton dmoverton self-assigned this Nov 10, 2021
@dmoverton
Copy link
Contributor

A fix for this has been released in v2.1.0-beta.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working p/high candidate for being included in the upcoming sprint
Projects
None yet
Development

No branches or pull requests