aws_events.Rule doesn't accept aws_events_targets.SfnStateMachine as a target
See original GitHub issueWhen trying to add a target to an event in Python, following error is produced on synth
:
Error: Resolution error: Supplied properties not correct for "CfnRuleProps"
targets: element 0: supplied properties not correct for "TargetProperty"
arn: required but missing.
Rule is aws_events.Rule
object, and target is aws_events_targets.SfnStateMachine
.
Reproduction Steps
event = aws_events.Rule(
self,
id="Scheduled event",
enabled=True,
schedule=aws_events.Schedule.expression(app_config["event_schedule"])
)
event.add_target(aws_events_targets.SfnStateMachine(machine=state_machine))
Error Log
/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/resolvable.js:51
throw e;
^
Error: Resolution error: Supplied properties not correct for "CfnRuleProps"
targets: element 0: supplied properties not correct for "TargetProperty"
arn: required but missing.
Object creation stack:
at new Intrinsic (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/private/intrinsic.js:20:44)
at new PostResolveToken (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/util.js:72:9)
at CfnRule._toCloudFormation (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/cfn-resource.js:167:39)
at elements.map.e (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/stack.js:547:60)
at Array.map (<anonymous>)
at Stack._toCloudFormation (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/stack.js:547:36)
at Stack.synthesize (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/stack.js:500:42)
at Function.synth (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/construct.js:65:27)
at App.synth (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/app.js:71:52)
at process.App.process.once (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/app.js:45:51)
at Object.onceWrapper (events.js:286:20)
at process.emit (events.js:198:13)
at ValidationResult.assertSuccess (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/runtime.js:126:19)
at cfnRulePropsToCloudFormation (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/aws-events/lib/events.generated.js:165:39)
at CfnRule.renderProperties (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/aws-events/lib/events.generated.js:214:16)
at PostResolveToken.ret.Resources.util_1.PostResolveToken.props [as processor] (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/cfn-resource.js:178:52)
at PostResolveToken.postProcess (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/util.js:80:21)
at Object.postProcess (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/private/resolve.js:30:82)
at DefaultTokenResolver.resolveToken (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/resolvable.js:42:38)
at resolve (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/private/resolve.js:94:33)
at Object.resolve (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/private/resolve.js:28:33)
at resolve (/tmp/jsii-kernel-8Mu6hw/node_modules/@aws-cdk/core/lib/private/resolve.js:111:43)
Environment
- CLI Version : 1.13.1 (build 96cfc63)
- Framework Version: 1.13.1
- OS : Fedora
- Language : Python
Other
This happens in all following cases:
- By supplying
targets
keyword in rule constructor - By using
add_target()
on rule object - By using
bind(rule_obj)
on target object
I also checked target type LambdaFunction
, but it works (aside from type mismatch, target is based on object
instead of implementing IRuleTarget
expected by rule object)
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
aws-cdk/aws-events-targets module - AWS Documentation
The code snippet below creates an event rule with a Lambda function as a target triggered for every events from aws.ec2 source. You...
Read more >@aws-cdk/aws-events-targets - npm
The code snippet below creates an event rule with a Lambda function as a target triggered for every events from aws.ec2 source. You...
Read more >@aws-cdk/aws-events-targets NPM | npm.io
The code snippet below creates an event rule with a Lambda function as a target triggered for every events from aws.ec2 source. You...
Read more >adding etl workflow to event rule - AWS re:Post
import * as events from "@aws-cdk/aws-events"; const rule = new events. ... I can't find glue workflow as a target on the targets...
Read more >@aws-cdk/aws-events-targets | Yarn - Package Manager
... classes to send Amazon EventBridge to any number of supported AWS Services. Instances of these classes should be passed to the rule.addTarget()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SomayaB I might be out of the loop, but shouldn’t label “package/events” be more appropriate?
The same error happens with having codepipeline as a target for an event as well.
below is the code