当我尝试部署示例代码时,在触发意图上我不断收到语法错误。
我在另一台具有相同代码的机器上尝试了此操作,这使我认为它可能与没有正确的依赖关系有关。
app.intent('Build the Order', async (conv) => {
let skus;
try {
skus = await getSkus(conv.request.conversation.conversationId);
if (skus.length === 0) {
conv.close('Oops, looks like there is nothing available.'
+ ' Please try again later');
return;
}
} catch (error) {
console.log(error);
conv.close(`Oops, looks like there was an internal error.`
+ ` Please try again later.`);
return;
}
// Create a mapping of SkuId.id to Sku object
conv.data.skus = skus.reduce((acc, curr) => {
acc[curr.skuId.id] = curr;
return acc;
}, {});
// Build the order
const responsePrefix = 'Great! I found the following items: ';
conv.ask(`${responsePrefix} ${buildSimpleResponse(skus)}.` +
` Which one do you want?`);
if (conv.screen) {
conv.ask(buildCarousel(skus));
}
});
我立即得到的错误是第一行异步(conv)中的“(”是意外的。就像我说的那样,我只是部署示例代码并且它在另一台机器上工作。我只是不想开始更改示例代码,但不知道还要尝试什么。