如何解决为什么我的函数返回未找到项目的错误
美好的一天
我在 Twilio 中构建了一个 Studio 应用程序,在应用程序调用 Autopilot 函数之前,该应用程序运行良好,该函数又使用函数。但是该函数不断给出错误, “错误:未找到请求的资源 /Services/ISc792090dd21fa5fce6df0c691e7a7b70/Lists/orders/Items”。如果我查看调试器,所有元素都在那里。
不确定我在设置功能时遗漏了什么。所有字段和示例都已设置,新类型也已创建,同步。
我的函数代码如下所示。
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));
};
任何帮助将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。