Skip to content

fix(lambda): grantInvoke on imported function fails#10622

Merged
mergify[bot] merged 7 commits intomasterfrom
njlynch/lambda-grant-invoke-imported
Oct 12, 2020
Merged

fix(lambda): grantInvoke on imported function fails#10622
mergify[bot] merged 7 commits intomasterfrom
njlynch/lambda-grant-invoke-imported

Conversation

@njlynch
Copy link
Copy Markdown
Contributor

@njlynch njlynch commented Oct 1, 2020

PR #8828 added the ability to add permissions on imported functions, if the
account on the stack and imported function matched. However, when this doesn't
match, attempting to call grantInvoke on the imported function results in a
findChild error.

This change guards against calling addPermission when canCreatePermissions
is false by checking if the CfnPermission was actually created, and adjusting
the return from addInvoke appropriately.

fixes #10607


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@njlynch njlynch requested a review from a team October 1, 2020 11:30
@njlynch njlynch self-assigned this Oct 1, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 1, 2020
@njlynch njlynch requested a review from nija-at October 5, 2020 14:06
@njlynch njlynch requested a review from rix0rrr October 5, 2020 14:26
PR #8828 added the ability to add permissions on imported functions, if the
account on the stack and imported function matched. However, when this doesn't
match, attempting to call `grantInvoke` on the imported function results in a
`findChild` error.

This change guards against calling `addPermission` when `canCreatePermissions`
is false by checking if the `CfnPermission` was actually created, and adjusting
the return from `addInvoke` appropriately.

fixes #10607
@njlynch njlynch force-pushed the njlynch/lambda-grant-invoke-imported branch from 15f2877 to cff3888 Compare October 7, 2020 17:54
@nija-at nija-at added the pr/do-not-merge This PR should not be merged at this time. label Oct 8, 2020
njlynch and others added 2 commits October 8, 2020 14:56
Co-authored-by: Niranjan Jayakar <nija@amazon.com>
@njlynch njlynch removed the pr/do-not-merge This PR should not be merged at this time. label Oct 12, 2020
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 12, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 02373a2
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 12, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[elasticloadbalancingv2] Can't use imported lambda with ELBv2

4 participants