2

I have an event in AWS Serverless with the following YML :

service: change-status-to-insale
provider:
  name: aws
  runtime: nodejs12.x
functions:
  changeWeeklyStarterStatus:
    # Two Minutes : 0 */2 * ? * *   
    handler: handler.changeWeeklyStarterStatus
    schedule: cron(0 */2 * ? * *)
    enabled: true

I've uploaded using the command

serverless deploy

I've tried to invoke it every 2 minutes using the formula :

0 */2 * ? * *

However the event is not triggered.

I've tested it using the Test button and it runs the function perfectly.

But it's still not triggered.

Why ? What am I missing ?

1
  • 0 */2 * ? * * (it's basically for At minute 0 past every 2nd hour.) Commented Jan 8, 2020 at 12:49

1 Answer 1

4

You have used wrong configuration for cron expression. use */2 * * * ? * for every 2 minute.

How to schedule from AWS Cloudwatch

enter image description here

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks , I've changed it to your formula and it's still not invoked.
Why don't you use the AWS Cloudwatch console service and schedule it from there using the Events. Just create a new rule, schedule it and set Target as your lambda . It's working for me.
I have edited my answer and attached the screenshot for your reference.
You're awesome ! So what's the deal with the YAML file ? it doesn't do the job ? useless ?
Thanks :) Not sure about that, may be for just local invocation as SAM Template it's required, will check and update.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.