From 4113003c1d5fd70ac45f9720a8cd2bf47166c663 Mon Sep 17 00:00:00 2001 From: ac360 Date: Thu, 17 Mar 2016 16:27:04 -0700 Subject: [PATCH] EndpointDeployApiGateway: fix custom authorizer to use stages --- lib/actions/EndpointDeployApiGateway.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/actions/EndpointDeployApiGateway.js b/lib/actions/EndpointDeployApiGateway.js index 30d8bf011..147cfb3d0 100644 --- a/lib/actions/EndpointDeployApiGateway.js +++ b/lib/actions/EndpointDeployApiGateway.js @@ -405,7 +405,7 @@ module.exports = function(S) { _this.authorizers[f.name] = a.id; // Add permission to the authorizer Lambda so API G can access it - let functionName = f.getDeployedName({ stage: _this.evt.options.stage, region}); + let functionName = f.getDeployedName({ stage: _this.evt.options.stage, region }); return _this._removeLambdaPermissionForAuthorizer(functionName, region) .then(function() { return _this._addLambdaPermissionForAuthorizer(functionName, region); @@ -490,6 +490,7 @@ module.exports = function(S) { let params = {}; params.Action = 'lambda:InvokeFunction'; params.FunctionName = functionName; + params.Qualifier = _this.evt.options.stage; params.Principal = 'apigateway.amazonaws.com'; params.StatementId = lambdaPolicyStatementId; params.SourceArn = 'arn:aws:execute-api:' @@ -559,7 +560,7 @@ module.exports = function(S) { + 'removed existing lambda access policy statement for this authorizer'); }) }) - .catch(function(error) {}); + .catch(function(error) {console.log(error)}); } }