我想使用twilio函数&由运行时客户端同步。
我在下面创建了函数并出现错误
exports.handler = function(context, event, callback) {
let sync = Runtime.getSync();
sync.lists('list_keys').syncListItems.get(0).then(function(response){
console.log(response);
callback(null);
});
错误
{
message: 'sync.lists(...).syncListItems.get(...).then is not a function',
name: 'TypeError',
stack: 'TypeError: sync.lists(...).syncListItems.get(...).then is not a function
}
当我使用所有方法删除,获取,获取时,我仍然会得到相同的错误。
如何使用运行时客户端从syncListItems
获取密钥?
答案 0 :(得分:0)
我在@Twilio工作,所以我可以帮助你。
您正在查看错误的Sync文档;您想要Sync API文档:https://www.twilio.com/docs/sync/api/lists。 Runtime.getSync()
基本上会从示例中返回client.sync.services('default')
。
特别是您的示例,您要查找的代码是:
exports.handler = function(context, event, callback) {
const sync = Runtime.getSync();
sync.syncLists('list_keys')
.syncListItems(0)
.fetch()
.then(response => {
console.log(response);
callback(null);
});
});
如果这令人困惑,我很抱歉。我将确保更新Runtime客户端上的文档,使其指向正确的页面。