From 80bef08c3fc678096f31b8a1ea46ec8b3e635db9 Mon Sep 17 00:00:00 2001 From: Bob Potterveld Date: Wed, 7 Jul 2021 22:14:00 -0600 Subject: [PATCH] Fix "TypeError: AWS.LexRuntimeV2 is not a constructor" when using Lex V2 based Elicit Response Bots. Fix "Cannot read property 'buttons' of undefined" when no buttons specified in response card. Bug fix - protect against TypeError exception while processing fallback intent case for an invalid response provided to a LexV2 Response Bot. --- CHANGELOG.md | 4 ++++ lambda/fulfillment/Makefile | 2 +- lambda/fulfillment/lib/middleware/lexRouter.js | 3 ++- package.json | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d558b3d..83dbb0588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [4.7.2] +- Bug fix "TypeError: AWS.LexRuntimeV2 is not a constructor" when using Lex V2 based Elicit Response Bots. +- Bug fix "Cannot read property 'buttons' of undefined" when no buttons specified in response card. +- Bug fix Protect against TypeError exception while processing fallback intent case for an invalid response provided to a LexV2 Response Bot. ## [4.7.1] - Amazon Elasticsearch version 7.10 is now utilized. - Encrypted Elasticsearch (production) instance types now use m6g.large.elasticsearch for improved price/performance/memory. diff --git a/lambda/fulfillment/Makefile b/lambda/fulfillment/Makefile index f231bc435..f2e1ef5c2 100644 --- a/lambda/fulfillment/Makefile +++ b/lambda/fulfillment/Makefile @@ -3,4 +3,4 @@ DST=../../build/lambda/$(NAME).zip RESOURCES := $(shell find . | grep -v node_modules | grep -v test ) $(DST): $(RESOURCES) - echo "Building $(NAME)"; npm install -production && zip -r -q $(DST) . + echo "Building $(NAME)"; rm $(DST); npm install -production && zip -r -q $(DST) . diff --git a/lambda/fulfillment/lib/middleware/lexRouter.js b/lambda/fulfillment/lib/middleware/lexRouter.js index e53232f79..7105a63b9 100644 --- a/lambda/fulfillment/lib/middleware/lexRouter.js +++ b/lambda/fulfillment/lib/middleware/lexRouter.js @@ -79,6 +79,7 @@ function lexV1ClientRequester(params) { }); } function lexV2ClientRequester(params) { + console.log(`aws sdk version is ${AWS.VERSION}`); const lexV2Client = new AWS.LexRuntimeV2(); return new Promise(function(resolve, reject) { lexV2Client.recognizeText(params, function(err, data) { @@ -319,4 +320,4 @@ async function processResponse(req, res, hook, msg) { return resp; } -exports.elicitResponse=processResponse; \ No newline at end of file +exports.elicitResponse=processResponse; diff --git a/package.json b/package.json index 694c843ae..0e0f42a66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-ai-qna-bot", - "version": "4.7.1", + "version": "4.7.2", "engines": { "node": ">=12.16.1", "npm": ">=7.8.0"