Skip to content

Commit

Permalink
fix: function e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akshbhu committed May 8, 2021
1 parent 673aaa7 commit 3a5bee5
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ export async function updateWalkthrough(context, lambdaToUpdate?: string) {
merge(functionParameters, additionalParameters);

updateCFNFileForResourcePermissions(resourceDirPath, functionParameters, currentParameters);
} else {
// Need to load previous dependsOn
functionParameters.dependsOn = _.get(context.amplify.getProjectMeta(), ['function', lambdaToUpdate, 'dependsOn'], []);
}

// ask scheduling Lambda questions and merge in results
Expand Down Expand Up @@ -353,7 +350,7 @@ export function updateCFNFileForResourcePermissions(
apiResourceName,
);

if (cfnContent.Resources.AmplifyResourcesPolicy > 0) {
if (!cfnContent.Resources.AmplifyResourcesPolicy) {
cfnContent.Resources.AmplifyResourcesPolicy = {
DependsOn: ['LambdaExecutionRole'],
Type: 'AWS::IAM::Policy',
Expand All @@ -366,12 +363,15 @@ export function updateCFNFileForResourcePermissions(
],
PolicyDocument: {
Version: '2012-10-17',
Statement: functionParameters.categoryPolicies,
Statement: [],
},
},
};
} else {
}
if (functionParameters.categoryPolicies.length === 0) {
delete cfnContent.Resources.AmplifyResourcesPolicy;
} else {
cfnContent.Resources.AmplifyResourcesPolicy.Properties.PolicyDocument.Statement = functionParameters.categoryPolicies;
}

cfnContent.Resources.LambdaFunction.Properties.Environment.Variables = getNewCFNEnvVariables(
Expand Down

0 comments on commit 3a5bee5

Please sign in to comment.