hasura / hasura/graphql-engine

Remote join failing when including aliased remote join keys in query

Open
#7,180 0 comments 2 reactions 1 assignee Claimed by @0x777 View on GitHub
c/server k/bug p/high
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Using `v2.0.1-cloud.1`.
We have a remote schema to another hasura instance, hosted in Heroku, which is currently still in version `v1.0.0-beta.4`. I'm mentioning this because I'm not sure which one is causing the issue.

A table on the 2.0.1 instance has a remote relationship (say it's named `details`) to a table on the 1.0.0 instance, based on two fields (I'll call them `name` and `type`).
The remote relationship works as expected, unless both the below conditions are true:

1. `name` and/or `type` is included in the query return values
2. at least one of them is aliased (for example `r_name: name`).

If the two conditions above are true, the remote relationship returns `null` for all objects in the query, although the fields themselves return their values.

For example, the below
```
{
my_table (limit: 1) {
details {
id
}
id
type
}
}
```
will return:
```
{
"data": {
"my_table": [
{
"details": [
{
"id": 123
}
],
"id": 456
"type": "type1"
}
]
}
}
```
while the below:
```
{
my_table (limit: 1) {
details {
id
}
id
r_type: type
}
}
```
will return:
```
{
"data": {
"my_table": [
{
"details": null,
"id": 456,
"r_type": "type1"
}
]
}
}
```

This issue seems very similar to #7125 but I'm adding it separately because, unlike in that description, the query works if the field is not aliased.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.