-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Unable to synthesize when calling grantInvoke(ServicePrincipal.Builder.create("events.amazonaws.com")
#8240
Labels
Comments
john-tipper
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
May 27, 2020
SomayaB
added
@aws-cdk/aws-iam
Related to AWS Identity and Access Management
@aws-cdk/aws-lambda
Related to AWS Lambda
and removed
@aws-cdk/aws-iam
Related to AWS Identity and Access Management
labels
Jun 1, 2020
There was no breaking change intended for this module on those releases. I was able to reproduce this with a simple typescript app - import { ServicePrincipal } from '@aws-cdk/aws-iam';
import { Code, Runtime, SingletonFunction } from '@aws-cdk/aws-lambda';
import { App, Stack } from '@aws-cdk/core';
const app = new App();
const stack = new Stack(app, 'mystack');
const fn = new SingletonFunction(stack, 'fn', {
code: Code.fromInline('foo'),
runtime: Runtime.NODEJS_12_X,
handler: 'index.handler',
uuid: '92e0bbf2-10d2-427c-9f79-79f671303428',
});
fn.grantInvoke(new ServicePrincipal('events.amazonaws.com')); This is a bug. |
We're tracking this bug here - #8295 |
mergify bot
pushed a commit
that referenced
this issue
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*
nija-at
pushed a commit
that referenced
this issue
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
There appears to have been a breaking change between 1.38.0 and 1.39.0 for which I cannot find documentation and which continues in recent versions.
I attempt to grant permission to
events.amazonaws.com
to trigger my lambda, using the code below:When I attempt to synthesize the stack, I get an exception with the message:
Reproduction Steps
I create a lambda using:
then attempt to grant permissions to the
events
AWS service principal:Error Log
Environment
Other
There is no exception when using 1.38.0, but this issue appears to affect all subsequent versions, including 1.42.0.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: