-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws-autoscaling: Schedule.cron fails with "Cannot supply both 'day' and 'weekDay', use at most one" #27256
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-autoscalingRelated to Amazon EC2 Auto ScalingRelated to Amazon EC2 Auto ScalingbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2
Description
Describe the bug
Using the Schedule.cron fails on aws-cdk-lib==2.97.0 at synth time.
Cannot supply both 'day' and 'weekDay', use at most one
This is how I was calling it before:
autoscaling.Schedule.cron(
week_day="MON-SUN",
hour="1", # 01:00 UTC+0 ~ 20:00 int PET (-05:00)
minute="0",
)
The problem may be here:
aws-cdk/packages/aws-cdk-lib/aws-autoscaling/lib/schedule.ts
Lines 22 to 29 in 42494f1
| const cron = super.protectedCron({ | |
| weekDay: '*', // to override core.Schedule's default | |
| day: '*', // to override core.Schedule's default | |
| ...options, | |
| }); | |
| const cronSplit = cron.expressionString.slice(5).split(' '); // remove "cron(" from start | |
| cronSplit.pop(); // remove year, since autoscaling does not accept it | |
| const autoscalingCron = cronSplit.join(' '); |
Expected Behavior
This was working before:
autoscaling.Schedule.cron(
week_day="MON-SUN",
hour="1", # 01:00 UTC+0 ~ 20:00 int PET (-05:00)
minute="0",
)
Current Behavior
Error at synth time:
RuntimeError: Error: Cannot supply both 'day' and 'weekDay', use at most one
Reproduction Steps
Install latest aws-cdk-lib
Possible Solution
Workaround:
aws-cdk-lib==2.96.0
Additional Information/Context
No response
CDK CLI Version
2.97.0 (build d7cf3be)
Framework Version
No response
Node.js Version
v20.5.1
OS
Linux
Language
Python
Language Version
Python 3.11.5
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-autoscalingRelated to Amazon EC2 Auto ScalingRelated to Amazon EC2 Auto ScalingbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2