From c7afad9e184af90b726e377d6d4de568ad91a5f9 Mon Sep 17 00:00:00 2001 From: doapp-ryanp Date: Mon, 21 Sep 2015 09:57:31 -0500 Subject: [PATCH] fix lambda name generation --- lib/utils/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index 5c14c7b72..f52cdd8af 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -212,7 +212,10 @@ module.exports.generateLambdaName = function(awsmJson) { var handlerName = awsmJson.lambda.cloudFormation.Handler.replace('aws_modules', ''), resourceAction = handlerName.substr(0, handlerName.lastIndexOf('/')); - return 'l' + resourceAction.replace(/\/([a-z])/g, function(g) { + //We prefix with an l to make sure the CloudFormation resource map index is unique + //we will probably have API gateway resources in their own CF JSON but we dont want to + //make that decsision until CF has API gateway support + return 'l' + resourceAction.replace(/(\/|-|_)([a-z])/g, function(g) { return g[1].toUpperCase(); }); };