I'm trying to schedule a job to run with agenda.now() while passing some data to jobs.attrs.data:
agenda.now('myJob', { data: data }, (error, jobSaved) => {
if (error) {
console.error("Error saving job: ", error);
res.send(error);
} else {
console.log("The job was correctly saved!");
res.sendStatus(200);
}
};
But this throws an error:
Error: This function does not accept a callback function. 3/2
If I run this with only the data or only the callback, it runs correctly, but passing them both throws the error.
I'm using the exact structure in agenda.schedule() and agenda.every() with the same data and callback, and everything's running fine. It's just the now() function.
Am I missing something?
It looks like agenda got a rewrite with promises and the documentation wasn't updated. Callbacks are no longer accepted.
https://github.com/agenda/agenda/commit/b9ecca90916abc88c95d5f229a3fa21c7e356504#r30854923
That was it, thanks a lot!
indeed - it's time to change this:
indeed - it's time to change this:
Docs updated 馃憤
Most helpful comment
It looks like agenda got a rewrite with promises and the documentation wasn't updated. Callbacks are no longer accepted.
https://github.com/agenda/agenda/commit/b9ecca90916abc88c95d5f229a3fa21c7e356504#r30854923