Serverless-offline: support for scheduled events

Created on 22 Jun 2016  路  9Comments  路  Source: dherault/serverless-offline

is there a way to get scheduled events supported?
ie;=:
"events": [
{
"name": "schedule",
"type": "schedule",
"config": {
"schedule": "rate(5 minutes)"
}
}
]

enhancement help wanted

Most helpful comment

There is a serverless plugin for this now:
https://github.com/ajmath/serverless-offline-scheduler

All 9 comments

I don't know what are scheduled events yet. Is it like a cron call on your lambda?

@dherault, yup, they're created via CloudFormation in serverless. They're actually "Events" in CloudWatch, exactly like cron calls. As far as I can tell, they need to be enabled manually the first time they're deployed with serverless.

@vanerleo, I think enabling events would be tricky for serverless-offline and might be better suited for a separate plugin. It would involve keeping track of event trigger times and the current time/date, which seems something system-wide and beyond the scope of a stateless HTTP server.

However, a convenient way to load the entire serverless-offline environment and manually run a function would be nice. Something like sls offline run functionName?

agreed ,sls offline run functionName would be a good feature to set up all vars at least

@andreipopovici in regards to enabling them in CouldWatch, i've read that having a setting in "config"
{
"enabled": true
}

should enable it ... but so far no luck with getting it to auto enable on first deploy
see https://github.com/serverless/serverless/issues/698
https://github.com/serverless/serverless/issues/939

@vanerleo I had no idea about the enabled flag! Thanks for that 馃憤

With [email protected] and higher, I think that the default sls function run functionName actually loads all env variables specified in the _meta folder for that particular stage, so that's a possible existing replacement.

@vanerleo, I would see the ability to run scheduled events as part of a fork of serverless-offline, made with the purpose of replacing AWS Lambda itself with a self-hosted solution (to help escape vendor lock-in). Till then, I recommend closing this issue, if you and @dherault agree.

There is a serverless plugin for this now:
https://github.com/ajmath/serverless-offline-scheduler

@vangorra nice one, thanks

Thanks @vanerleo its working after added plugin. :+1:

@vangorra, it works with nodejs functions only

TY @vangorra, it's work for me. i tried for the other plugin serverless-offline-schedule but the plugin have a bug when try to run.

Was this page helpful?
0 / 5 - 0 ratings