'Cron job in lambda in Node.js
I created a lambda function with cron schedule but cron not starting.
var request = require('request');
var cron = require('node-cron');
const mysql = require('serverless-mysql')({
config: {
host: process.env.DB_HOST,
database: process.env.DB_NAME,
user: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD
}
})
exports.handler = async (event, context) => {
task = cron.schedule('*/5 * * * *', () => {
console.log('started..')
}, {
scheduled: false
});
task.start();
return {status:"SUCCESS"};
}
What can I try to resolve this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|