Post with array input cannot have lambda in function stack?

JG Member ✭

I have a POST endpoint that is ingesting webhooks from a third party (wrike). The payloads are a single array like this:
"title": "Follow up on status of RFI with Architects",
"oldValue": "Follow up on status of RFI with Architect",
"eventType": "TaskTitleChanged",
"eventAuthorId": "KUAEW7KF",
"lastUpdatedDate": "2023-03-05T20:48:17Z"

When anywhere in my stack i try to do a lambda step, i get the following error: ["$input must be an object"].

My lambda code is not part of the error, i've set the code to: return "John Doe";.
It seems like the lambda is expecting the $input parameter to always contain an object, which is not always the case with webhooks.

Is there any way to fix this?



  • arturosanz
    arturosanz Member ✭✭

    Why don't you check first if the "Get All Input" result is an object or not with the filter "is_object". If it is false, just create an object containing whatever the result was. Then do the lambda step.