AWS lambda 中未捕获的异常 javascript
Uncaught exception in AWS lambda javascript
我正在尝试通过 lambda 从 Amazon LEX 中引出一个意图,但我收到了调用未捕获异常的错误。感谢您的帮助,我的代码如下:
'use strict';
exports.handler = (event, context, callback) => {
const sessionAttributes = event.sessionAttributes;
const slots = event.currentIntent.slots;
const intention = slots.Intention
{
let response = {
sessionAttributes: event.sessionAttributes,
dialogAction: {
type: "ElicitIntent",
message: {
contentType: "PlainText",
content: `Would you like to do A or B? `
}
}
}
callback(null, response);
}
}
“未捕获的异常”错误通常意味着没有为特定类型的输入提供响应。在您的情况下,回调未到达。
只需删除多余的花括号组(我已将其注释掉):
'use strict';
exports.handler = (event, context, callback) => {
const sessionAttributes = event.sessionAttributes;
const slots = event.currentIntent.slots;
const intention = slots.Intention
//} <--remove this
let response = {
sessionAttributes: event.sessionAttributes,
dialogAction: {
type: "ElicitIntent",
message: {
contentType: "PlainText",
content: `Would you like to do A or B? `
}
}
}
callback(null, response);
//} <--and remove this
}
我正在尝试通过 lambda 从 Amazon LEX 中引出一个意图,但我收到了调用未捕获异常的错误。感谢您的帮助,我的代码如下:
'use strict';
exports.handler = (event, context, callback) => {
const sessionAttributes = event.sessionAttributes;
const slots = event.currentIntent.slots;
const intention = slots.Intention
{
let response = {
sessionAttributes: event.sessionAttributes,
dialogAction: {
type: "ElicitIntent",
message: {
contentType: "PlainText",
content: `Would you like to do A or B? `
}
}
}
callback(null, response);
}
}
“未捕获的异常”错误通常意味着没有为特定类型的输入提供响应。在您的情况下,回调未到达。
只需删除多余的花括号组(我已将其注释掉):
'use strict';
exports.handler = (event, context, callback) => {
const sessionAttributes = event.sessionAttributes;
const slots = event.currentIntent.slots;
const intention = slots.Intention
//} <--remove this
let response = {
sessionAttributes: event.sessionAttributes,
dialogAction: {
type: "ElicitIntent",
message: {
contentType: "PlainText",
content: `Would you like to do A or B? `
}
}
}
callback(null, response);
//} <--and remove this
}