Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

twilio - why does my function return error with items not found

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...