Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron scheduled syntax is rejected #2344

Closed
chris-hailstorm opened this issue Oct 12, 2016 · 14 comments
Closed

Cron scheduled syntax is rejected #2344

chris-hailstorm opened this issue Oct 12, 2016 · 14 comments

Comments

@chris-hailstorm
Copy link

chris-hailstorm commented Oct 12, 2016

Maybe a bug in the service, maybe a doco bug, I can't tell --

  1. Using this serverless.yml:
service: xxxxxxxx

provider:
    name: aws
    runtime: python2.7
    stage: prod
    region: us-east-1

package:
    exclude:
        - __vendored-**

functions:
    run:
        handler: handler.run
        timeout: 20
        events:
            - schedule:
                cron: cron(5 8 * * ? *)
                enabled: false

Produces this error:
Serverless Error ---------------------------------------

 Missing "rate" property for schedule event in function
 run The correct syntax is: schedule: rate(10 minutes)
 OR an object with "rate" property. Please check the
 docs for more info.

The documentation at https://serverless.com/framework/docs/providers/aws/events/schedule/ suggests this events / schedule / cron syntax would be OK.

  1. Single-line variation (with no enabled field):
service: xxxxxxxx

provider:
    name: aws
    runtime: python2.7
    stage: prod
    region: us-east-1

package:
    exclude:
        - __vendored-**

functions:
    run:
        handler: handler.run
        timeout: 250
        events:
            - schedule: cron(5 8 * * ? *)

This variation works fine.

@rowanu
Copy link
Member

rowanu commented Oct 12, 2016

Yep, this is a bug bug. It's an issue with the schedule object check.

I will submit a fix.

@rowanu
Copy link
Member

rowanu commented Oct 13, 2016

Upon closer inspection, this is not a bug 😕 Probably just needs some better examples in the docs using the cron syntax.

Change your cron property name in your schedule event to rate and it will work i.e.:

...
        events:
            - schedule:
                rate: cron(5 8 * * ? *)
                enabled: false

@chris-hailstorm
Copy link
Author

Confirmed

@chris-hailstorm
Copy link
Author

chris-hailstorm commented Nov 7, 2016

Now using Serverless v1.1.0, this cron syntax is failing:

    funcname:
        events:
            - schedule:
                rate: cron(0 5 * * * ?)

with this error message:

Serverless: Deployment failed!

  Serverless Error ---------------------------------------

     An error occurred while provisioning your stack: SenderEventsRuleSchedule1
     - Parameter ScheduleExpression is not valid..

The rate: rate(5 minutes) syntax is working, but the cron-ized version fails.

@rowanu
Copy link
Member

rowanu commented Nov 7, 2016

You cannot have a "?" in the year (last) field (as per the docs).

I think you mean to use:

rate: cron(0 5 * * ? *)

@pmuens
Copy link
Contributor

pmuens commented Nov 18, 2016

Closing this one as @rowanu provided a solution 👍

Let us know if this is still an issue!

@veerarajuthuta
Copy link

veerarajuthuta commented Jul 19, 2021

schedule rate "cron" not yet supported!
scheduler: invalid, schedule syntax
Scheduling [pullDataFromQueue] cron: [undefined] input: undefined

we are facing this error

@pgrzesik
Copy link
Contributor

Hello @veerarajuthuta - could you please share full details about your problem? It would be great to include reproducible example as well as the full output with the error.

@milkstork-kevin
Copy link

The error "scheduler: invalid, schedule syntax" is coming from the serverless-offline package and it seems to be due to the fact that scheduling isn't supported by the package right now.

@RavenHursT
Copy link

events:
    - schedule: rate(10 minutes)

works just fine for serverless-offline... So it's just rate: cron([whatever]) that isn't supported?

Is this documented anywhere?

@mnapoli
Copy link
Contributor

mnapoli commented Aug 4, 2022

@RavenHursT you can open an issue in the plugin's repository.

@RavenHursT
Copy link

@mnapoli So... I take it that's a "no"?

@mnapoli
Copy link
Contributor

mnapoli commented Aug 5, 2022

@RavenHursT that is an issue with the plugin. I don't know if it's documented in the plugin or not, but in any case this should be discussed there.

I don't think pinging people on an unrelated issue from 2016 will yield changes on the plugin.

@RavenHursT
Copy link

RavenHursT commented Aug 5, 2022

@mnapoli my mistake.. I was under the impression that serverless-offline was a package maintained by the serverless org.

@dherault any chance you could shed light onto whether or not this caveat it documented somewhere.

Given that so many devs rely upon serverless-offline for local development would it possibly be prudent upon the serverless org to ingest serverless-offline into their ecosystem? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants