Skip to content

Cron expression doesn't work for scheduling functions #2406

@lwang-79

Description

@lwang-79

Environment information

System:
  OS: macOS 15.1.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 248.80 MB / 32.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 22.9.0 - /opt/homebrew/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 10.8.3 - /opt/homebrew/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.5.1
  @aws-amplify/backend: 1.12.0
  @aws-amplify/backend-auth: 1.4.2
  @aws-amplify/backend-cli: 1.4.6
  @aws-amplify/backend-data: 1.4.0
  @aws-amplify/backend-deployer: 1.1.13
  @aws-amplify/backend-function: 1.11.0
  @aws-amplify/backend-output-schemas: 1.4.0
  @aws-amplify/backend-output-storage: 1.1.4
  @aws-amplify/backend-secret: 1.1.4
  @aws-amplify/backend-storage: 1.2.4
  @aws-amplify/cli-core: 1.2.1
  @aws-amplify/client-config: 1.5.5
  @aws-amplify/deployed-backend-client: 1.5.0
  @aws-amplify/form-generator: 1.0.3
  @aws-amplify/model-generator: 1.0.12
  @aws-amplify/platform-core: 1.5.0
  @aws-amplify/plugin-types: 1.7.0
  @aws-amplify/sandbox: 1.2.9
  @aws-amplify/schema-generator: 1.2.6
  aws-amplify: 6.6.2
  aws-cdk: 2.173.2
  aws-cdk-lib: 2.173.2
  typescript: 5.6.2
No AWS environment variables
No CDK environment variables

Describe the bug

The cron expressions described in this documentation doesn't work, and received the following error.

Failed to instantiate schedule for nodejs function
Caused By: Cron field for month must be a whole number between 1 and 12\nCron expressions cannot have both day-of-month and day-of-week defined, you must use a ? in one of the fields\nCron field for month must be a whole number between 1 and 12\nCron expressions cannot have both day-of-month and day-of-week defined, you must use a ? in one of the fields

It seems that the validateCron function doesn't accept the * wildcard.

Reproduction steps

Follow the documentation to set the schedule for a function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existspending-triageIncoming issues that need categorization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions