question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws_autoscaling]: Cron expression invalid

See original GitHub issue

Describe the bug

autoscaling.Schedule.cron({ minute: "*" }) produces expression that is not wrapped in cron(...) as in aws-cdk v1.

Expected Behavior

ScheduleExpression should be wrapped in cron(...). It worked in v1.

Current Behavior

Produces resource with invalid ScheduleExpression prop:

{
 "Resources": {
  "ruleF2C1DCDC": {
   "Type": "AWS::Events::Rule",
   "Properties": {
    "ScheduleExpression": "* * * * *",
    "State": "ENABLED"
   },
   "Metadata": {
    "aws:cdk:path": "TestStack/rule/Resource"
   }
  }
 },
/// ....

Reproduction Steps

Following code:

#!/usr/bin/env ts-node

import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_events as events } from 'aws-cdk-lib';


const app = new cdk.App();
const scope = new cdk.Stack(app, "TestStack")

const expression = autoscaling.Schedule.cron({ minute: "*" });

const rule = new events.Rule(scope, 'rule', { schedule: expression });

Produces resource with invalid ScheduleExpression prop:

{
 "Resources": {
  "ruleF2C1DCDC": {
   "Type": "AWS::Events::Rule",
   "Properties": {
    "ScheduleExpression": "* * * * *",
    "State": "ENABLED"
   },
   "Metadata": {
    "aws:cdk:path": "TestStack/rule/Resource"
   }
  }
 },
/// ....

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.31.0 (build b67950d)

Framework Version

No response

Node.js Version

v16.14.0

OS

Mac OS 12.3

Language

Typescript

Language Version

No response

Other information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TheRealAmazonKendracommented, Aug 3, 2022

I know the naming isn’t ideal but I don’t actually think this is something we should be handling for. As long as it’s clearly documented, which I believe it is, it is the users responsibility to ensure they’re importing the correct version of a class. If we tried to do this for every instance of a class that shares a name in a different module, it would be extremely messy.

0reactions
github-actions[bot]commented, Aug 3, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameter ScheduleExpression is not valid - Stack Overflow
I have tried setting the cron expression on the Lambda console (when creating the function and choosing Cloudwatch Schedule Event), and in the...
Read more >
Example scheduled actions for Application Auto Scaling
To schedule scaling on a recurring schedule, use the --schedule "cron( fields )" option. For more information, see Schedule recurring scaling actions using...
Read more >
Schedule Expressions for Rules - Amazon CloudWatch Events
Describes how to use cron or rate expressions to automate AWS with Amazon CloudWatch Events.
Read more >
Troubleshoot service auto scaling issues in Amazon ECS
The service auto scaling configured for my Amazon Elastic ... The cron expression format is incorrectly specified in the scheduled action.
Read more >
Reference: Cron and rate expressions for Systems Manager
When you create a State Manager association or a maintenance window in AWS Systems Manager, you specify a schedule for when the window...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found