Post with array input cannot have lambda in function stack?
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",
"taskId": "IEACIWZSKQZGQVIU",
"oldValue": "Follow up on status of RFI with Architect",
"eventType": "TaskTitleChanged",
"webhookId": "IEACIWZSJAABNRYU",
"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?
Answers
-
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.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback