-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-eventsRelated to CloudWatch EventsRelated to CloudWatch EventsbugThis issue is a bug.This issue is a bug.p1
Description
What is the problem?
When setting up a rule against a lambda defined in another stack that is in the same account and region. CDK is now returning an error:
"You need to provide a concrete account for the target stack when using cross-account or cross-region events"
This is for any CDK version > 2.3.0
Reproduction Steps
Create and export the ARN of a lambda function from one stack. Add a policy to the function that allows "lambda:InvokeFunction". In another stack use "Function.fromFunctionArn"
Example:
const importedFunction = lambda.Function.fromFunctionArn(this, "ImportedFunction", cdk.Fn.importValue("OtherStack-ExportedFunctionARN"));
new events.Rule(this, "Rule", {
schedule: events.Schedule.expression("cron(0 * * * ? *)"),
targets: [
new targets.LambdaFunction(importedFunction, {}),
],
});What did you expect to happen?
Expect the rule to be created and the rule is able to execute the remote function.
What actually happened?
/cdk/node_modules/aws-cdk-lib/aws-events/lib/rule.ts:134
throw new Error('You need to provide a concrete account for the target stack when using cross-account or cross-region events');CDK CLI Version
2.7.0
Framework Version
2.7.0
Node.js Version
16.13.1
OS
OSX M1
Language
Typescript
Language Version
4.5
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Labels
@aws-cdk/aws-eventsRelated to CloudWatch EventsRelated to CloudWatch EventsbugThis issue is a bug.This issue is a bug.p1