我在文件中添加了以下块serverless.yml
来安排 CRON:
testCron1:
handler: handler.testCron1
events:
- schedule: cron(15 14 22 MAY FRI 2020)
然后我在文件中创建一个testCron1
lambda 函数。handle.js
const testCron1 = (event, context) => {
return new Promise(async (resolve, reject) => {
console.log("*********** NEW est CRON ************");
console.log("Current Time ==> ", new Date(moment().utc().format()));
resolve(true);
});
}
当我尝试使用命令进行部署时serverless deploy
,它给了我以下错误:
An error occurred: TestCron1EventsRuleSchedule1 - Parameter ScheduleExpression is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code:ValidationException; Request ID: c5b3178b-348a-4ffd-a205-d5255dcca2ab)