(aws-scheduler-targets): singletonScheduleRole() generates targetArn hash incorrectly #30584
Labels
@aws-cdk/aws-scheduler-targets
Related to targets of the AWS Scheduler service
bug
This issue is a bug.
duplicate
This issue is a duplicate.
Describe the bug
Creating two or more
LambdaInvoke
s with different lambda functions causes synth time error: Resolution error: All principals in a PolicyStatement must have the same Conditions.The role is created in
ScheduleTargetBase.singletonScheduleRole()
.Expected Behavior
Multiple
LambdaInvoke
with different functions work with no errors.Current Behavior
Error occuers on synth.
Reproduction Steps
Deploy stack contains following lambda functions and schedules.
Possible Solution
singletonScheduleRole()
generates target arn hash usingstack.resolve(targetArn).toString()
.But when targetArn is lambda.Function.functionArn,
stack.resolve()
returns an object{"Fn:GetAtt":["xxxxxx","Arn"]}
, thentoString()
returns a constant string"[object Object]"
.This means different lambda functions share same hash.
Using
JSON.stringify()
instead of.toString()
may resolve.Additional Information/Context
No response
CDK CLI Version
2.146.0
Framework Version
No response
Node.js Version
20.14.0
OS
Ubuntu 20.04
Language
TypeScript
Language Version
No response
Other information
#28713: same error message, but reproduction steps differ.
The text was updated successfully, but these errors were encountered: