Good day
I have built a Studio app in Twilio, this works fine up until the app calls an Autopilot function which in turn uses a Function. However the function keeps on giving an error,
" Error: The requested resource /Services/ISc792090dd21fa5fce6df0c691e7a7b70/Lists/orders/Items was not found". If I look at the Debugger all the elements are there.
Not sure what I have missed in setting up the function. All fields and samples have been setup, the new types have also been created, and the Sync.
My Function code looks like this.
exports.handler = function(context, event, callback) {
const ORDER_LIST = 'orders';
const SERVICE_SID = context.SYNC_SERVICE_SID;
const orderType = event.Field_PackType_Value;
const orderQuantity = event.Field_Quantity_Value || 1;
const order = `${orderQuantity} x ${orderType}`;
const orderData = {
order: order,
phoneNumber : event.UserIdentifier,
status: 'open'
};
//Create a sync list item for the order
const twilioClient = context.getTwilioClient();
twilioClient.sync
.services(SERVICE_SID)
.syncLists(ORDER_LIST)
.syncListItems.create({data: orderData})
.then(x => {
callback(null, {
actions: [
{
"say": `Thank you for ordering ${order}`
}
]
});
})
.catch(err => callback(err));
};
Any help would be greatly appreciated.
question from:
https://stackoverflow.com/questions/65842083/why-does-my-function-return-error-with-items-not-found 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…