Ash FrameworkAF
Ash Framework6mo ago
6 replies
zeropoint

Having trouble with AshGraphql subscriptions dsl

I created a subscription:
subscriptions do
  pubsub __.Endpoint
  subscribe :resource_name_updated do
    action_types [:create, :update]
  end
end

and subscribed like so:
subscription {
  resourceNameUpdated {
   created {
      id
    }
    updated {
      id
    }
  }
}

This always returns the following (no matter if I called an update or create action):
{
  "data": {
    "resourceNameUpdated": {
      "created": null,
      "updated": {
        "id": "fbc962bd-ed42-4a00-b050-76773d0db450"
      }
    }
  }
}

The subscription itself works fine, but I can't get any results to flow through the created key in the response. If I remove the :update atom from action_types, the graphql would return properly underneath the create key:
{
  "data": {
    "resourceNameUpdated": {
      "created": "fbc962bd-ed42-4a00-b050-76773d0db450"
    }
  }
}
Was this page helpful?