我已经构建了aws lambda函数,该函数充当代码钩子并验证了我构建的lex机器人。该特定模块应该对外部API进行API调用,并识别票证是否不存在。但是同步发生了一些事情,因为它没有意识到该号码不存在并且一直在继续。我已经在这里发布了代码:https://pastebin.com/ejWyjPFX
问题区域在这里:
function validateCheckIn(ticketNumber, laptop, airMagnet, software, zip, callback) {
const confirmations = ['Yes', 'Yeah', 'Yes I do', 'Yep', 'I do', 'a'];
if (ticketNumber) {
if (ticketNumber.length != 6) {
return this.callback(buildValidationResult(false, 'Ticket_Number', 'Ticket number ' + ticketNumber + ' is not valid. I need the six digit ticket number for the job you\'re checking in for.'));
}
ticketExists = checkIfTicketExists(ticketNumber);
if (!ticketExists) {
return this.callback(buildValidationResult(false, 'Ticket_Number', 'That ticket number does not exist.'));
}
}