timhall / svelte-apollo

Svelte integration for Apollo GraphQL
MIT License
944 stars 68 forks source link

Problem with Subscription on FK related fields #100

Closed yorgyetson closed 3 years ago

yorgyetson commented 3 years ago

I'm not sure if this is the best place for this, but I am running into an issue where my subscription is working in Hasura, but throws an error when using svelte-apollo.

This is my query:

subscription ($id: uuid!) {
  rooms_by_pk(id: $id) {
    name
    id
    calls {
      id
      user {
        display_name
      }
    }
  }
}

Rooms has a working array relationship to calls. Each call has a user relationship as well.

Through a subscription to the rooms table I can get all columns from the calls table except for items in the user relationship.

When it is run in Hasura explorer, it works fine and returns the correct results including the user columns. When it is run in svelte-apollo, it errors out with "field \"user\" not found in type: 'calls'"

I'm not sure if this is a problem with the schema Hasura produces, an apollo issue, or an issue with svelte-apollo specifically.

Any help would be appreciated.

yorgyetson commented 3 years ago

So this was just a permissions issue in Hasura.

When testing through the Hasura console, I was an admin with full permissions to all tables.

The client side user role assigned by the JWT did not have permission to select the required fields from the user table.

There is no svelte apollo issue here.