question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intermittent error when querying a remote schema joined graphQL field.

See original GitHub issue

Given the following graphql query

query myQuery($param1:String!, $param2: String!) {
  my_table {
    id
    name
    
    externallyJoinedField(other_param_1: $param1, other_param_2: $param2) {
      external_field_1
      external_field_2
    }
  }
}

made with the following variables (for posterity, however the values do not matter)

{
  "param1": "p1",
  "param2": "p2"
}

where externallyJoinedField is a remotely joined field, the query (for me at least) fails intermittently (~50%?) with the following error:

{
  "errors": [
    {
      "extensions": {
        "path": "$.variableValues",
        "code": "validation-failed"
      },
      "message": "unexpected variables: param2, param1"
    }
  ]
}

Once it fails, it seems like reloading the metadata resolves the issue for…some amount of indeterminate time. Otherwise continuing to query with the same query will sometimes work again.

At first I was worried that remote joins didn’t support a field that had more arguments than the values provided by hasura to join on. However, even if that is true (which would be unfortunate) the main concern for me here is the intermittent nature of this behavior, which would imply to me that whatever it is, is not supposed to happen. Would love to know the expected behavior here, and what would cause this error.

Details

Version - v1.3.1 Metadata.yml:

version: 2
tables:
- table:
    schema: public
    name: my_table
  remote_relationships:
  - definition:
      remote_field:
        external_field:
          arguments:
            id: $id
      hasura_fields:
      - id
      remote_schema: remote-schema
    name: externallyJoinedField
remote_schemas:
- name: remote-schema
  definition:
    url: http://host.docker.internal:3099/graphql
    timeout_seconds: 60

Remote Schema Graphql Schema

type ExternalType {
  external_field_1: String!,
  external_field_2: String!
}

type Query {
  external_field(
    id: String!
    other_param_1: String!
    other_param_2: String!
  ): [ExternalType!]
}

I know this is a weird issue, and it’s very possible I’ve done something weird on my end that’s causing this, but I tried to isolate the configuration down to be as simple as possible, and am still able to trigger this. If there’s more information I can provide to help debug or reproduce please let me know.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
tirumaraiselvancommented, Nov 5, 2020

@cozmo We are investigating this.

1reaction
cozmocommented, Nov 4, 2020

Hmm, @MinJunKimKR, that’d be surprising to me. As I understand it, _eq is a param that hasura exposes in the resolvers for tables it manages. For the external schemas, hasura (I think) just directly exposes the underlying graphql schema, without any changes. At least this has been my experience with external schemas up until this point. As you can see in my remote graphql schema above, the external_field doesn’t expose _eq, but rather some params directly. As such, I’d expect you’d pass them directly when interacting with the remote joined field.

This is backed up by the fact that the graphql schema, when querying hasura with an introspection query, as well as when interacting with the graphql editor in the hasura console both (correctly) have these params directly on the remote field, vs any _eq param.

Additionally, the fact that this query only fails intermittently to me implies that the query itself isn’t incorrect, but rather there’s some sort of issue executing it. However maybe I misunderstand something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Full Stack Error Handling with GraphQL and Apollo
If networkError is present in your response, it means your entire query was rejected, and therefore no data was returned. For example, the ......
Read more >
Five Common Problems in GraphQL Apps (And How to Fix ...
Schema duplication; Server/client data mismatch; Superfluous database calls; Poor performance; Boilerplate overdose. I'm willing to bet your app ...
Read more >
Top GraphQL Errors and How to fix them
Top GraphQL Errors and How to Fix them ; data; errors or; both. ; Bad request (400); Unauthorized (401); Gateway errors (5xx) ;...
Read more >
Known issues with Microsoft Graph
This article describes known issues and limitations with Microsoft Graph and provides workarounds when possible.
Read more >
Stardog Platform Release Notes | Stardog Documentation 7.7.3
VG query with Service Join might throw CyclicMetadataException (#PLAT-2644) ... does not show error details (#8558); Preserve user-submitted GraphQL schema ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found