APIGateway Permissions issue (+ possible solution)
MartinRisk opened this issue · comments
When functions in the serverless template have two functions where one function starts withj the name of another, the permissions are messed up.
For example
function1 :GetDetailsForUser
function2 :GetDetails
Result is that the permissions for GetDetails are set to the function GetDetailsForUser
When I change the order of the functions in my serverless things work ok.
The plugins has the following code in apiGateway.js: 281
const versionName = _.find(_.keys(versions), version => _.startsWith(version, functionName )); const aliasName = _.find(_.keys(aliases), alias => _.startsWith(alias, functionName ));
The problem is the .startsWith.
Problem can be solved by changing the code to
const versionName = _.find(_.keys(versions), version => _.startsWith(version, functionName + 'LambdaVersion)); const aliasName = _.find(_.keys(aliases), alias => _.startsWith(alias, functionName + 'Alias'));
Please update and deploy this fix
Regards,
Martin
Fixed in #162
PR is not merged yet, It's too early to close issue, I believe
Latest PR for this issue contains an error (Misjudged from my side). I'll create a PR for this.