(aws-events): circular dependency error when providing cross-stack Queue to Rule.addTarget() #30530
Labels
@aws-cdk/aws-events
Related to CloudWatch Events
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
Reopens to #18821
Original bug report reproduced below
Given one stack that creates a Queue
When I consume that Queue in another stack using Rule.addTarget(queue)
Then I get a circular dependency error
Expected Behavior
No circular dependency error.
Current Behavior
Error: 'QueueProducer' depends on 'QueueConsumer' (QueueProducer -> QueueConsumer/MyRule/Resource.Arn). Adding this dependency (QueueConsumer -> QueueProducer/MainQueue/Resource.Arn) would create a cyclic reference.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
Workaround: Use the queueArn to create a cross-stack reference, e.g.
credit
CDK CLI Version
2.145.0
Framework Version
No response
Node.js Version
18.18.1
OS
macOS 14.5
Language
TypeScript
Language Version
5.4.5
Other information
In my own encounter, its interesting to note that the error message seems to mention another queue, not the one that I'm actually referencing (and yes, I checked to make sure these were discrete and correct).
Code:
Error:
The payload decoder rule is receiving a reference to the payloadDecoder.queue, but the error references the normalisedUplinks.queue, which is also created in the other stack (I have a state stack, and a compute stack). Compute stack creates the rule, and references the queue in the state stack.
The text was updated successfully, but these errors were encountered: