From 9c9b7df026c7c02d99b93064b9d97b2bf154d058 Mon Sep 17 00:00:00 2001 From: abetomo Date: Wed, 29 Mar 2017 12:40:30 +0900 Subject: [PATCH 1/4] Bugfix InvalidParameterValueException is given when createFunction In updateFunctionConfiguration, we set empty characters so that setting can be erased, but failed when createFunction. --- lib/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index 5c70d275..71444bc0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -114,7 +114,9 @@ Lambda.prototype._params = function (program, buffer) { Variables: {} }, DeadLetterConfig: { - TargetArn: '' + // Set default value to null. + // Because createFunction fails if it is empty character. + TargetArn: null } }; if (program.lambdaVersion) { @@ -134,6 +136,13 @@ Lambda.prototype._params = function (program, buffer) { } } if (program.deadLetterConfigTargetArn) { + /* + * TODO: + * What do you do when you want to erase + * DeadLetterConfig settings? + * Passing empty characters cancels the setting + * but does not enter this if statement. + */ params.DeadLetterConfig = { TargetArn: program.deadLetterConfigTargetArn }; From ecdd09bd4e0d3a6df5e933d14b40ec6b2a02cbad Mon Sep 17 00:00:00 2001 From: abetomo Date: Wed, 29 Mar 2017 17:17:03 +0900 Subject: [PATCH 2/4] Fix use the empty string as a value, so I checked undefined --- bin/node-lambda | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/node-lambda b/bin/node-lambda index 2e890618..7b8aed8b 100755 --- a/bin/node-lambda +++ b/bin/node-lambda @@ -31,12 +31,18 @@ var AWS_PUBLISH = process.env.AWS_PUBLISH || false; var AWS_FUNCTION_VERSION = process.env.AWS_FUNCTION_VERSION || ''; var AWS_VPC_SUBNETS = process.env.AWS_VPC_SUBNETS || ''; var AWS_VPC_SECURITY_GROUPS = process.env.AWS_VPC_SECURITY_GROUPS || ''; -var AWS_DLQ_TARGET_ARN = process.env.AWS_DLQ_TARGET_ARN || ''; var EVENT_FILE = process.env.EVENT_FILE || 'event.json'; var PACKAGE_DIRECTORY = process.env.PACKAGE_DIRECTORY; var CONTEXT_FILE = process.env.CONTEXT_FILE || 'context.json'; var PREBUILT_DIRECTORY = process.env.PREBUILT_DIRECTORY || ''; var DEPLOY_ZIPFILE = process.env.DEPLOY_ZIPFILE || ''; +var AWS_DLQ_TARGET_ARN = (function() { + // You can clear the setting by passing an empty string + // when executing updateFunctionConfiguration + if (process.env.AWS_DLQ_TARGET_ARN !== undefined) + return process.env.AWS_DLQ_TARGET_ARN + return undefined; +})(); program .command('deploy') From bf6c86ec1453d9a3cd3179ed70a78c91c973d290 Mon Sep 17 00:00:00 2001 From: abetomo Date: Wed, 29 Mar 2017 17:18:39 +0900 Subject: [PATCH 3/4] Fix to undefined check Use an empty string as a value --- lib/main.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/main.js b/lib/main.js index 71444bc0..21d99e3e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -114,8 +114,6 @@ Lambda.prototype._params = function (program, buffer) { Variables: {} }, DeadLetterConfig: { - // Set default value to null. - // Because createFunction fails if it is empty character. TargetArn: null } }; @@ -135,14 +133,7 @@ Lambda.prototype._params = function (program, buffer) { Variables: config } } - if (program.deadLetterConfigTargetArn) { - /* - * TODO: - * What do you do when you want to erase - * DeadLetterConfig settings? - * Passing empty characters cancels the setting - * but does not enter this if statement. - */ + if (program.deadLetterConfigTargetArn !== undefined) { params.DeadLetterConfig = { TargetArn: program.deadLetterConfigTargetArn }; From 851188a5e9f5042e331bd34bd2e7c62412bd737a Mon Sep 17 00:00:00 2001 From: abetomo Date: Wed, 29 Mar 2017 17:22:52 +0900 Subject: [PATCH 4/4] Remove AWS_DLQ_TARGET_ARN from example file Make it undefined --- lib/.env.example | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/.env.example b/lib/.env.example index 5165a68c..65305a4f 100644 --- a/lib/.env.example +++ b/lib/.env.example @@ -13,6 +13,5 @@ AWS_DESCRIPTION= AWS_RUNTIME=nodejs6.10 AWS_VPC_SUBNETS= AWS_VPC_SECURITY_GROUPS= -AWS_DLQ_TARGET_ARN= EXCLUDE_GLOBS="event.json" PACKAGE_DIRECTORY=build