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

2.5.0 GraphQL error when invoking action with a relationship: "a join column is missing from the response"

Open Jrodseth opened this issue 4 years ago • 10 comments

Version Information

Server Version: 2.5.0 CLI Version (for CLI related issue):

Environment

OSS

What is the expected behaviour?

Calling an action with a relationship should return without an error.

Keywords

2.5.0, a join column is missing from the response, unexpected

What is the current behaviour?

When an action with a relationship is called, a graphql error is returned by the server. Apollo client resolves the error to:

{
  "graphQLErrors": [
    {
      "extensions": {
        "path": "$",
        "code": "unexpected"
      },
      "message": "a join column is missing from the response: <related_table_id>_join_column"
    }
  ],
  "clientErrors": [],
  "networkError": null,
  "message": "a join column is missing from the response: <related_table_id>_join_column",
}

where <related_table_id> is the name of the field which joins the relationship.

How to reproduce the issue?

  1. Create an action in < 2.5.0 with a relationship
  2. Update to 2.5.0
  3. Invoke the action

Any possible solutions?

Potential regression / bug introduced in 2.5.0

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

Still investigating

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

Maybe

Jrodseth avatar Apr 13 '22 20:04 Jrodseth

Hi @Jrodseth

Does the issue go away if you go back to v2.4.0? Would you be able to help us with a repro? You can either share your metadata with the action definition, types and postgres table schema or construct a minimal example.

I tried the following and not facing the reported error:

This is my action:

type Mutation {
  actionName(
    arg1: SampleInput!
  ): SampleOutput
}

input SampleInput {
  username: String!
  password: String!
}

type SampleOutput {
  accessToken: String!
  name: String!
}

I created a relationship from table user (id, name, email) to the name field in SampleOutput:

image

I can run a query as follows without any errors:

mutation {
  actionName(arg1: {password: "adfa", username: "adfa"}) {
    accessToken
    actionRelationship {
      email
    }
  }
}

image

tirumaraiselvan avatar Apr 14 '22 10:04 tirumaraiselvan

Hey @tirumaraiselvan thanks for looking into this.

Yes, we saw the issue go away when we reverted to 2.4.0. I'll scrub some of our metadata and put it into a minimal example today.

Jrodseth avatar Apr 14 '22 13:04 Jrodseth

Hey, just wanted to confirm this error. Reverting back to 2.4.0 helped

isilweo avatar Apr 15 '22 07:04 isilweo

@Jrodseth Any luck with the repro? Happy to just get your metadata and take it from there. You can mail me at [email protected]

tirumaraiselvan avatar Apr 18 '22 14:04 tirumaraiselvan

Same issue here on v2.5.0-cloud.2, works fine on v2.3.1-cloud.1

LucaDe avatar Apr 18 '22 15:04 LucaDe

@tirumaraiselvan thanks, I've been tight on time. I'll email you!

Jrodseth avatar Apr 18 '22 18:04 Jrodseth

@isilweo / @LucaDe Can you help us with a repro?

0x777 avatar Apr 19 '22 05:04 0x777

I was on vacation and just noticed that my main feature of my production app did broke because of the automatic cloud updates once again... please think about auto updating cloud versions or give some notice when it will happen, so you can monitor the release in time!

Is there a fix for the cloud version available? It's still not working on 2.5.1-cloud.1

Otherwise, thanks for the great tool and support 👍

Edit: The support did upgrade my cloud version to 2.6.1-cloud.1, unfortunately it didn't solve the issue yet 😔

marcel-happyfloat avatar May 05 '22 16:05 marcel-happyfloat

I found the issue. It's a breaking change somewhat after 2.3.x, which should be documented @tirumaraiselvan.

I got an action result type defintion like this:

type UpsertEnrolmentOutput {
  id: uuid
  missing_requirements: jsonb
}

Both id and missing_requirements are optional and my action handler did only return one or the other field, which was working fine before. The id field has a related relationship. Now I'm returning null instead and it is working again.

Edit: I'm still having other Actions, where I'm only returning the property if it has an actual value... still seems to work, as long as the property has no connected relationship.

marcel-happyfloat avatar May 06 '22 12:05 marcel-happyfloat

@happyfloat Sorry about this experience. We are definitely working on improving this going ahead.

Meanwhile, would you be able to create a new issue which illustrates your bug?

tirumaraiselvan avatar May 07 '22 04:05 tirumaraiselvan