Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Nothing happening #30

Open
Meemaw opened this issue Aug 4, 2019 · 5 comments
Open

Nothing happening #30

Meemaw opened this issue Aug 4, 2019 · 5 comments

Comments

@Meemaw
Copy link

Meemaw commented Aug 4, 2019

I'm trying out this plugin via:

λ → sls schedule
Serverless: scheduler: scheduling schedule-executors/schedule-executors with */1 * * * *
Serverless: schedule-executors

and

λ → serverless offline

... but I'm not seeing anything happening.

Functionn is defined as:

functions:
  schedule-executors:
    handler: src/functions/scheduleExecutors/index.handler
    events:
      - schedule:
          name: your-scheduled-rate-event-name
          description: 'your scheduled rate event description'
          rate: rate(1 minute)  
@itskemo
Copy link

itskemo commented Dec 18, 2019

Make sure to put the serverless-offline-scheduler ABOVE the serverless-offline in the list of plugins:

// serverless.yml

plugins:
# ... other plugins
  - serverless-offline-scheduler  # <----- keep it above the serverless-offline
# ... other plugins
  - serverless-offline

@ajmath
Copy link
Owner

ajmath commented Dec 26, 2019

Something else to keep in mind is that this won't launch the functions immediately. For rate(1 minute) functions, it will happen at the 00 second mark every minute. For example, if you run serverless schedule with your function config at 9:01:01, the function won't actually be executed until 9:02:00. You can use the recently added --runSchedulesOnInit cli arg to have them invoked immediately

@m0hdasif
Copy link

m0hdasif commented Feb 1, 2020

Hi Ajmath,

This plugin is working with either of these command:

  • sls offline start
  • sls schedule

But not with this command:

  • sls offline

May I know the reason behind it?

@ErikAndreas
Copy link

I get it to run once on init using sls offline start --stage dev --runSchedulesOnInit but then nothing happens and when I stop (ctrl +c) sls then it shows:
Error: Command failed: C:\Program Files\nodejs\node.exe C:\<redacted>\serverless.js invoke local --function rateTest --data {"account":"<redacted>","region":"serverless-offline","detail":{},"detail-type":"Scheduled Event","source":"aws.events","time":"2020-03-09T08:52:14.196Z","id":"<redacted>","resources":["arn:aws:events:serverless-offline:123456789012:rule/rateTest"],"isOffline":true} --stage dev at checkExecSyncError (child_process.js:611:11) at Object.execFileSync (child_process.js:629:15)
sls schedule seems to work but then other plugins (dynamodb etc) are not started...

@kaskelotti
Copy link

@m0hdasif the serverless plugins have some sort of "lifecycle" and you need to trigger it with start command in order to startup properly. The same applies for example to AWS DynamoDB local plugin.

Unfortunately I could not find the docs where this is explained.

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

No branches or pull requests

6 participants