Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda): SingletonFunction.grantInvoke() API fails with error 'No child with id' #8296

Merged
merged 2 commits into from
Jun 1, 2020

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Jun 1, 2020

Updates to the Grant API1 introduced the need to return the statement
that was added as a result of the grant operation.

A corresponding change2 was applied to lambda module's FunctionBase
class with the intention to apply this across all constructs that are
variants of Function.

However, the SingletonFunction construct behaves differently in how it
modifies the construct tree. Specifically, it contains no child node but
instead manipulates a node that is a direct child of the Stack node.
For this reason, this.node.findChild() API does not return the
expected underlying node.

The fix here is to allow such special inheritors of FunctionBase to
override where the child node is to be found, via an internal method
called _functionNode().

fixes #8240


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

…No child with id'

Updates to the Grant API[1] introduced the need to return the statement
that was added as a result of the grant operation.

A corresponding change[2] was applied to lambda module's `FunctionBase`
class with the intention to apply this across all constructs that are
variants of `Function`.

However, the `SingletonFunction` construct behaves differently in how it
modifies the construct tree. Specifically, it contains no child node but
instead manipulates a node that is a direct child of the `Stack` node.
For this reason, `this.node.findChild()` API does not return the
expected underlying node.

The fix here is to allow such special inheritors of `FunctionBase` to
override where the child node is to be found, via an internal method
called `_functionNode()`.

[1]: 1819a6b
[2]: 1819a6b#diff-73cb0d8933b87960893373bd263924e2
@nija-at nija-at requested review from rix0rrr and a team June 1, 2020 10:01
@nija-at nija-at self-assigned this Jun 1, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 1, 2020
@mergify
Copy link
Contributor

mergify bot commented Jun 1, 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
Collaborator

AWS CodeBuild CI Report

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

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Contributor

mergify bot commented Jun 1, 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).

@mergify mergify bot merged commit a8b1815 into master Jun 1, 2020
@mergify mergify bot deleted the nija-at/singletonFunction-grantInvoke branch June 1, 2020 11:52
nija-at pushed a commit that referenced this pull request Jun 1, 2020
…No child with id' (#8296)

Updates to the Grant API[1] introduced the need to return the statement
that was added as a result of the grant operation.

A corresponding change[2] was applied to lambda module's `FunctionBase`
class with the intention to apply this across all constructs that are
variants of `Function`.

However, the `SingletonFunction` construct behaves differently in how it
modifies the construct tree. Specifically, it contains no child node but
instead manipulates a node that is a direct child of the `Stack` node.
For this reason, `this.node.findChild()` API does not return the
expected underlying node.

The fix here is to allow such special inheritors of `FunctionBase` to
override where the child node is to be found, via an internal method
called `_functionNode()`.

fixes #8240

[1]: 1819a6b
[2]: 1819a6b#diff-73cb0d8933b87960893373bd263924e2


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.

Unable to synthesize when calling grantInvoke(ServicePrincipal.Builder.create("events.amazonaws.com")
3 participants