Working code:
module.exports = () => ({
bootstrap({ strapi }) {
strapi.cron.add({
myJob: {
task: ({ strapi }) => {
console.log("hello from plugin");
},
options: "* * * * * *", // << No `rule` here
},
});
},
});
That’s just a bug with the upstream types in the package we use, it would only impact TS users using strick types, you can just disable the TS check there until the upstream maintainers fix it.
Well I say that three times already, it’s not a typescript bug, it’s a js bug, it’s not accepting rule
in options
Is a TS bug not a plain bug
Since if I do it in javascript it works fine
And I should know since I made the pr to fix this
That’s even more weird, since it was a ts issue it wouldn’t compile, and it compiles and doesn’t work
Can you give me an example of the broken code?
module.exports = () => ({
bootstrap({ strapi }) {
strapi.cron.add({
myJob: {
task: ({ strapi }) => {
console.log("hello from plugin");
},
options: {
rule: "* * * * * *", // << Notice that `options` has an attribute `rule`
},
},
});
},
});
that one doesn’t, but try a different rule, I have felling that it creates default * * * * *
rule
Can you try giving the same thing to node-schedule - npm and see if it works then
to see if this is a node-schedule bug or strapi bug
Wait is this the right one
Ok not sure what’s going on but now both rules work
I think maybe this was due to fact that crontab guru uses * * * * *
and node schedule seems to use * * * * * *