I have attached an Appsync pipeline resolver to a field called paymentStatus in my Organisation object. The idea is that if an organisations last pay day has passed, I want to fetch the payment status from an external API using a Lambda function. If the pay day has not passed, I do not want to invoke the function but simply return a "OK".
Is there any way I can conditionally invoke a Lambda function? Something like this:
#if ($ctx.source.payday < $util.time.nowEpochSeconds())
{
"version": "2017-02-28",
"operation": "Invoke",
"payload": {
"arguments": {
"orgID": "$ctx.source.id"
}
}
}
#end
If I run this, Appsync complains about operation attribute missing when the condition is not met. I have also noted that the condition attribute which exists for queries is not available for Lambda datasources.
Thank you in advance <3