Closed gabrielecuccu closed 2 years ago
this happens with the latest serverless 2.59.0, it works with 2.54.0
Same problem here. I re-installed with sudo npm i -g serverless@2.54.0
and then re-deploy and it works.
I can't create a PR because I don't have write access to this repo, but this seems to solve the problem with latest serverless:
diff --git a/index.js b/index.js
index 41dbca7..b628203 100644
--- a/index.js
+++ b/index.js
@@ -70,7 +70,8 @@ function convertCrontabs() {
event.schedule.hasOwnProperty("timezone")
) {
const schedule = event.schedule;
- const match = schedule.rate.match(/^cron\((.*)\)$/);
+ const rate = Array.isArray(schedule.rate) ? schedule.rate[0] : schedule.rate;
+ const match = rate.match(/^cron\((.*)\)$/);
if (!match)
// skip rate() schedules
continue;
Basically after serverless 2.48 scheduler.rate is an array, so I'm wondering if using the first element of the array would be correct. This solves the problem for me. I'm facing other problems though, but it is probably another story.
@gabrielecuccu i created a fork and applied that patch: https://github.com/UnitedIncome/serverless-local-schedule/pull/21
Let's see if someone can approve/merge. Thanks for the fix.
@ejoncas-rivalbet I found this approach has bug. it breaks my scheduled lambda into huge amount of sub resources.
@pgrzesik I've opened another PR that should close out this issue, could you give it a look when you can?
Thanks @ramblingenzyme - I was unavailable for a few days but I've reviewed your proposal, thanks for patience
Hi, this error started today on my nightly deploy task:
I believe it relates to this bit of configuration in serverless.yml:
I was able to deploy the same code to UAT and to Production 2 days ago - this issue started on nightly provisioning only.
I don't know if it matters, I have been using serverless-local-schedule for about 1 year but with frameworkVersion < 2. Now I'm using frameworkVersion: "2"
Any idea? Thank you!