TypeError: scheduleEvent.replace is not a function
BhuvaneshwaranR opened this issue · 3 comments
BhuvaneshwaranR commented
config.yml
cron:
handler: cron
events:
- schedule:
name: schedule-cron
description: "Trigger the every Monday at 08:00 UTC"
rate: cron(0 8 ? * MON *)
Throws an error
Type Error ----------------------------------------------
TypeError: scheduleEvent.replace is not a function
at Scheduler._convertExpressionToCron (J:\project\node_modules\serverless-offline-scheduler\lib\scheduler.js:177:8)
_convertExpressionToCron(scheduleEvent) {
const params = scheduleEvent
.replace("rate(", "")
.replace("cron(", "")
.replace(")", "");
if (scheduleEvent.startsWith("cron(")) {
return this._convertCronSyntax(params);
}
if (scheduleEvent.startsWith("rate(")) {
return this._convertRateToCron(params);
}
this.serverless.cli.log("scheduler: invalid, schedule syntax");
return null;
}
_convertExpressionToCron function received scheduleEvent parameter as an array.
[ 'cron(0 8 ? * MON *)' ]
So replace function doesn't work on the array value. This has to be type-checked, iterated, and replace login should be applied.
focus1691 commented
I guess you fixed it but didn't publish the new changes on npm?
Ikrama312 commented
I'm facing the same issue.
danilaplee commented
why is this not merged? @ajmath