ajmath / serverless-offline-scheduler

MIT License
96 stars 40 forks source link

Cannot read property 'rate' of null #25

Closed adamwilbert closed 4 years ago

adamwilbert commented 5 years ago

Followed installation example, added scheduled event to one function in sls yml, cannot start offline or run sls schedule without getting Cannot read property 'rate' of null error

ajmath commented 5 years ago

Can you provide an example serverless.yml file?

adamwilbert commented 5 years ago
    events:
      - schedule:
          name: ${self:service}-${self:provider.stage}-func-warmer
          rate: rate(5 minutes)
          enabled: true
          input:
            warmer: true
            concurrency: 1

and i have included the plugin

ajmath commented 5 years ago

This smells like an issue with yaml formatting, but I can't really help out without more information. Do you have more information from the error, maybe a stack trace? A stand-alone project that exhibits the issue would be the most efficient way for me to properly triage.

gustblima commented 5 years ago

Same problem here

Edit: I found the solution, it was the formatting indeed. Changed the indentation for rate from 2 spaces to 4 spaces so from this:

events:
      - schedule:
        rate: "cron(1/* * * * *)"

to this:

events:
      - schedule:
          rate: "cron(1/* * * * *)"