Skip to content

Commit

Permalink
Update to version v5.3.1
Browse files Browse the repository at this point in the history
### Fixed

- Bug causing bot Fulfillment to fail on embeddings updates (#566)

### Updated

- VPC documentation update (SageMaker Serverless is not supported within a VPC)
- Security patches for npm and pip packages
  • Loading branch information
tabdunabi authored Mar 15, 2023
2 parents ecdf9f8 + c2c9f6f commit 0dc3403
Show file tree
Hide file tree
Showing 13 changed files with 209 additions and 125 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.3.1] - 2023-03-15

### Fixed

- Bug causing bot Fulfillment to fail on embeddings updates (#566)

### Updated

- VPC documentation update (SageMaker Serverless is not supported within a VPC)
- Security patches for npm and pip packages

## [5.3.0] - 2023-02-23

__*Note: we recommend that you first deploy these changes in a non-production environment. This is true for all releases, but especially important for minor and major releases.*__
Expand Down
2 changes: 2 additions & 0 deletions VPCSupportREADME.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ In order to deploy QnABot within a VPC two requirements must be met:
- [Give SageMaker Hosted Endpoints Access to Resources in Your Amazon VPC](https://docs.aws.amazon.com/sagemaker/latest/dg/host-vpc.html)
- [Connect to SageMaker Through a VPC Interface Endpoint](https://docs.aws.amazon.com/sagemaker/latest/dg/interface-vpc-endpoint.html)
- [AWS PrivateLink pricing](https://aws.amazon.com/privatelink/pricing/)
- [Serverless Inference Feature Exclusions](https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html)
- _Note: until VPC confirguration is supported for SageMaker Serverless Inference, your deployment will fail if trying to create/update a stack in a VPC with `SagemakerInitialInstanceCount` set to `0`_

2. A pre-configured VPC security group that
1. allows inbound connections on port 443 from other addresses in the VPC CIDR block. For example,
Expand Down
1 change: 1 addition & 0 deletions docs/architecture.xml

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions lambda/cfn/index.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
var cfnLambda=require('cfn-lambda')
var response=require('./lib/util/response')
var _=require('lodash')
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

const cfnLambda=require('cfn-lambda')
const response=require('./lib/util/response')
const _=require('lodash')

exports.handler=function(event,context,cb){
dispatch(event,context,cb)
}

var targets={
CognitoRole:require('./lib/CognitoRole'),
CognitoLogin:require('./lib/CognitoLogin'),
const targets={
ApiDeployment:require('./lib/ApiDeployment'),
CognitoDomain:require('./lib/CognitoDomain'),
CognitoLogin:require('./lib/CognitoLogin'),
CognitoRole:require('./lib/CognitoRole'),
CognitoUrl:require('./lib/CognitoUrl'),
ElasticSearchUpdate:require('./lib/ElasticSearchUpdate'),
ESCognitoClient:require('./lib/ESCognitoClient'),
LambdaVersion:require('./lib/LambdaVersion'),
Kibana:require('./lib/base'), // Kibana custom resource deprecated.. preserve entry here to avoid resource delete failure on stack upgrade.
PostUpgradeImport:require('./lib/PostUpgradeImport'),
PreUpgradeExport:require('./lib/PreUpgradeExport'),
S3Clear:require('./lib/S3Clear'),
S3Version:require('./lib/S3Version'),
S3Lambda:require('./lib/S3Lambda'),
S3Unzip:require('./lib/S3Unzip'),
S3Version:require('./lib/S3Version'),
Variable:require('./lib/Variable'),
ApiDeployment:require('./lib/ApiDeployment'),
ElasticSearchUpdate:require('./lib/ElasticSearchUpdate'),
ESCognitoClient:require('./lib/ESCognitoClient'),
PreUpgradeExport:require('./lib/PreUpgradeExport'),
PostUpgradeImport:require('./lib/PostUpgradeImport'),
Kibana:require('./lib/base'), // Kibana custom resource deprecated.. preserve entry here to avoid resource delete failure on stack upgrade.
}
var Lex=require('./lib/lex')
const Lex=require('./lib/lex')

function dispatch(event,context,cb){
console.log("event",JSON.stringify(event,null,2))
var type=event.ResourceType.match(/Custom::(.*)/)
var Lextype=event.ResourceType.match(/Custom::Lex(Bot|Alias|SlotType|Intent)/)
let type=event.ResourceType.match(/Custom::(.*)/)
let Lextype=event.ResourceType.match(/Custom::Lex(Bot|Alias|SlotType|Intent)/)
if(_.get(Lextype,1)==='Alias') Lextype[1]='BotAlias'
console.log(targets[type[1]])
console.log(targets[type[1]])

if(Lextype){
/* change to fix 4.4.0 installs where QNAPin and QNAPinNoConfirm elicit response bots inadvertently included a
* bad character in clarificationPrompt and rejectionStatement which would break further updates.
Expand All @@ -57,8 +61,8 @@ function dispatch(event,context,cb){
return cfnLambda(new targets[type[1]])(event,context,cb)
}else{
response.send({
event,
context,
event,
context,
reason:"Invalid resource type:"+event.ResourceType,
responseStatus:response.FAILED
})
Expand Down
24 changes: 24 additions & 0 deletions lambda/cfn/lib/LambdaVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

const aws=require('./util/aws')
const lambda=new aws.Lambda()

module.exports=class LambdaVersion extends require('./base') {
constructor(){
super()
}
Create(params,reply){

lambda.publishVersion({
FunctionName: params.FunctionName
}).promise()
.tap(console.log)
.then(result=>reply(null, result.Version, {"Version": result.Version}))
.catch(reply)
}

Update(ID,params,oldparams,reply){
this.Create(params,reply)
}
}
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qnabot-on-aws",
"version": "5.3.0",
"version": "5.3.1",
"engines": {
"node": ">=12.16.1",
"npm": ">=7.8.0"
Expand Down
4 changes: 2 additions & 2 deletions source/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
autopep8==2.0.0
black==23.1.0
flake8==6.0.0
mypy==1.0.0
pylint==2.16.1
mypy==1.1.1
pylint==2.17.0
28 changes: 11 additions & 17 deletions templates/examples/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
var fs=require('fs')
var _=require('lodash')
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

var examples=require(`./examples`);
var extensions=require(`./extensions`);
var resources=Object.assign(examples,extensions);
var outputs1=require('./outputs').outputs;
var outputs2=require('./examples/responsebots-lexv2').outputs;
var outputSNSTopic={"FeedbackSNSTopic":{"Value":{"Fn::GetAtt":["FeedbackSNS","TopicName"]}}};
var outputs=Object.assign(outputs1,outputs2,outputSNSTopic);
const examples=require(`./examples`);
const extensions=require(`./extensions`);
const resources=Object.assign(examples,extensions);
const outputs1=require('./outputs').outputs;
const outputs2=require('./examples/responsebots-lexv2').outputs;
const outputSNSTopic={"FeedbackSNSTopic":{"Value":{"Fn::GetAtt":["FeedbackSNS","TopicName"]}}};
const outputs=Object.assign(outputs1,outputs2,outputSNSTopic);

module.exports={
"Resources":resources,
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "(SO0189n-example) QnABot nested example resources",
"Mappings": {},
"Outputs": outputs,
"Parameters": {
"FulfillmentLambdaRole":{"Type":"String"},
"QnAType":{"Type":"String"},
"QnAType":{"Type":"String"},
"QuizType":{"Type":"String"},
"Index":{"Type":"String"},
"ESAddress":{"Type":"String"},
Expand Down Expand Up @@ -47,9 +46,4 @@ module.exports={
"CreateLexResponseBots":{"Fn::Equals":[{"Ref":"InstallLexResponseBots"},"true"]},
"CreateLexV1ResponseBots":{"Fn::And":[{"Condition":"CreateLexResponseBots"}, {"Condition":"CreateLexV1Bots"}]},
}
}





}
28 changes: 12 additions & 16 deletions templates/master/dashboard/lambdas.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
var fs=require('fs')
var _=require('lodash')
var util=require('./util')
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

var files=fs.readdirSync(`${__dirname}/..`)
const fs=require('fs')
const _=require('lodash')
const util=require('./util')

const files=fs.readdirSync(`${__dirname}/..`)
.filter(x=>!x.match(/README.md|Makefile|dashboard|index|test|.DS_Store/))
.map(x=>require(`../${x}`))

var lambdas={}
const lambdas={}
_.forEach(_.assign.apply({},files),(value,key)=>{
if(value.Type==='AWS::Lambda::Function' && key!=="ESInfoLambda"){
var type=_.fromPairs(value.Properties.Tags.map(x=>[x.Key,x.Value])).Type
if(!lambdas[type]){
lambdas[type]=[]
}
lambdas[type].push(key)
}
else if(value.Type==='AWS::Serverless::Function'){
var type = value.Properties.Tags.Type
let type=_.fromPairs(value.Properties.Tags.map(x=>[x.Key,x.Value])).Type
if(!lambdas[type]){
lambdas[type]=[]
}
Expand All @@ -26,12 +22,12 @@ _.forEach(_.assign.apply({},files),(value,key)=>{


module.exports=function(main_offset){
var Lambda_title=util.Title("## Lambda Function",main_offset+6)
let Lambda_title=util.Title("## Lambda Function",main_offset+6)

var lambda_widgets=_.map(lambdas,(value,key)=>{
let lambda_widgets=_.map(lambdas,(value,key)=>{
return {list:value.map(util.lambda),name:key}
}).reduce((accumulation,current)=>{
var title=util.Title(`### ${current.name}`,accumulation.offset)
let title=util.Title(`### ${current.name}`,accumulation.offset)
accumulation.offset+=title.height
accumulation.list.push(title)

Expand Down
17 changes: 7 additions & 10 deletions templates/master/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
var fs=require('fs')
var _=require('lodash')
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

var files=fs.readdirSync(`${__dirname}`)
const fs=require('fs')
const _=require('lodash')

const files=fs.readdirSync(`${__dirname}`)
.filter(x=>!x.match(/README.md|Makefile|index|test|.DS_Store/))
.map(x=>require(`./${x}`))

module.exports={
"Resources":_.assign.apply({},files),
"Conditions": {},
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": `(SO0189-ext) QnABot with admin and client websites - (Version v${process.env.npm_package_version})`,
"Mappings": {},
"Outputs": {
Expand Down Expand Up @@ -309,9 +311,4 @@ module.exports={
"EmbeddingsLambda":{"Fn::Equals":[{"Ref":"EmbeddingsApi"},"LAMBDA"]},
"EmbeddingsLambdaArn":{"Fn::Not": [{ "Fn::Equals":[{"Ref":"EmbeddingsLambdaArn"},""]}]}
}
}





}
Loading

0 comments on commit 0dc3403

Please sign in to comment.