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

remote schema relationship is null even though relationship exists when i have multiple relationships to the same schema

Open zolamk opened this issue 4 years ago • 7 comments

Version Information

Server Version: v2.3.1 CLI Version (for CLI related issue): v2.3.1

Environment

OSS

What is the expected behaviour?

all remote relationships to the same schema should not be null because one is null, hasura should return data for the available relationships and null for the unavailable ones

Keywords

remote-schema

What is the current behaviour?

I have a hasura server in which tables have created_by and updated_by columns, where updated_by is nullable like below

image

i have a remote schema relationship setup like this

image

created_by is set on insert operations and updated_by on update operations

image

when i query the data like this

query {
  users_roles {
    name
    creator {
      id
      name
    }
    updater {
      id
      name
    }
  }
}

for rows where updated_by is null both creator and updater remote schema relationships are null

image

How to reproduce the issue?

  1. created a table with created_by and updated_by columns related to a remote schema as creator and updater
  2. set created_by only for one of the rows
  3. query your data
  4. for the row where updated_by is not set, both creator and updater will be null

Screenshots or Screencast

image

image

image

image

Please provide any traces or logs that could help here.

Any possible solutions?

as a work around currently i am setting updated_by too on insert, but there are situations that solution is wrong

Can you identify the location in the source code where the problem exists?

No, i wish i could.

If the bug is confirmed, would you be willing to submit a PR?

I don't know Haskell 😟

zolamk avatar Mar 22 '22 07:03 zolamk

This is biting me too.

Can confirm that if one of the column values is null, then both remote relationships return null.

sheldonbaker avatar May 19 '22 17:05 sheldonbaker

I can confirm that I have also encountered the bug on my own project, but the workaround implemented by zolamk by setting a value anyway wouldn't work in my case since some of those fields are optional and cannot be set to a default value as easily as an "updated_by".

Quentin-Golliot avatar Jun 06 '22 15:06 Quentin-Golliot

Another possible work around might be providing a default value from your remote schema that returns a default for your relationship when a specific field value is sent from hasura

zolamk avatar Jun 08 '22 11:06 zolamk

Any updates on this issue ? I am also facing similar issues

vshelke avatar Jun 28 '22 17:06 vshelke

Any update on this issue...? We too are facing similar issue, since we have updated Hasura from v2.0.9 to 2.8.1.

harshalgalgale avatar Jun 29 '22 11:06 harshalgalgale

Facing the same issue here.. it would be great if we can fix this as soon as possible. 99% of our frontend (both web and mobile) are reliant on Hasura and we would love to use the new features of the latest releases but due to this bug we had to revert back to an older version. :(

cyber1998 avatar Jul 28 '22 11:07 cyber1998

Sorry for the delay! We have a PR with a fix, I'll let you know as soon as it is merged to main.

nicuveo avatar Oct 14 '22 17:10 nicuveo