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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation changes not yet committed when remote schema relationship is invoked? #7007

Open
ibrt opened this issue Jun 2, 2021 · 0 comments
Open

Comments

@ibrt
Copy link

ibrt commented Jun 2, 2021

Noticed this on Hasura 1.3.3, minimal example:

  • Remote schema remote:
type Details {
   an_interesting_detail: String
}

schema {
  query: {
    interesting_object_details(interesting_object_id: uuid!): Details
  }
}
  • Table exposed via Hasura interesting_objects:
CREATE TABLE interesting_objects (
  id uuid NOT NULL PRIMARY KEY,
  some_field text
);
  • Remote schema relationship attaching remote.interesting_object_details to interesting_objects.details with the id mapped as parameter.

So now I send this mutation:

mutation MyMutation {
    update_interesting_objects_by_pk(
        pk_columns: {
            id: "abc123..."
        }
        _set: {
            some_field: "some value"
        },
    ) {
        id
        some_value
        details {
          an_interesting_detail
       }
    }
}

The resolver in the remote schema reads from the same DB as Hasura, but it looks like it's getting an older version of the interesting_object without the updated value for some_field. I set this up locally and also added some delay in the resolver so I think it's because at the time when the remote schema is invoked the mutation transaction hasn't yet been committed. Is this expected behavior?

PS: I know there are other ways to achieve something similar using functions in Postgres, unfortunately in this case I really do need to run some custom code to generate an_interesting_detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant