Reputation: 195
AWS enhanced subscription filtering feature documentation recommends to add the following response mapping template:
## Response Mapping Template - onSpecialTicketCreated subscription
$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($util.parseJson($ctx.args.filter)))
$util.toJson($context.result)
When using a simple request mapping template the subscription will not return any data:
{
"version": "2017-02-28"
}
Upvotes: 1
Views: 705
Reputation: 195
The documentation does not mention the following (got it though one month of back and forth with support):
In the request template the payload must be set:
{
"version": "2017-02-28",
"payload": {}
}
If you have fieldLevel resolver note that for some reason they are executed when the subscription is set up and a payload is set. To accommodate this make sure they handle that i.e. event.source.id is not defined. For them to work pass the args as payload:
{
"version": "2017-02-28",
"payload": $util.toJson($ctx.args)
}
Using this frontend side filters like {"filter" : "{\"severity\":{\"le\":2}}"}
will work again
Upvotes: 0