I have a model configured like this:
type MyModel @model
@auth(rules: [
{ allow: owner },
{ allow: private, provider: iam, operations: [read, update] }
])
{
id: ID!
someValue: Int
otherValue: Int
}
and a subscription to the model:
const listener = API.graphql(graphqlOperation(onUpdateMyModel, {owner: user.username})).subscribe({
next: (updatedModel) => {
//do something
}
});
I also have a lambda that when triggered, updates otherValue
on the model via a graphQL mutation. This however, does not trigger the subscription listener.
I've tested that the listener picks up when the user updates the model and this works perfectly fine so I know the subscription is working in general.
The API is configured with the cognito user pool as the default auth.
I must be missing something here but I can't work out what. How do I ensure my listener picks up changes made by the Lambda?