Hey everyone!
I’m trying to create a scheduled job with no success, it’s not running.
The function has been tested and working, (triggered by button and not by schedule job)
I have a backend file called “DatabseJobs.jsw” , and the function called “syncCalendar()”
The jobs array is :
// /backend/jobs.config
{
"jobs": [ // Define up to 20 different jobs
{
"functionLocation": "/DatabaseJobs.jsw",
"functionName": "syncCalendar",
"description": "sync yachts calendar from CYA every day ",
"executionConfig": {
"time": "08:00",
}
}
]
}
@orhirschhorn14 If you say it runs when you call it, so the issue is probably somewhere else. And I can’t help…
But by the way I’d say the function could be written in a simpler & shorter way so it’ll be easier to debug.
Instead of using forEach(), you could do something like:
export function syncCalendar() {
return wixData.query("yachts2").find().then(results => {
let yachtCalenderArray = [];
return Promise.all(results.map(e => getYachtCalender(e.yachtId)));
})
etc...//use another Promise.all
//...
@orhirschhorn14 you know the time you set is UTC. Right?
Have a look at the site logs (if you connected it to Google Stackdriver maybe it logged an error.)
By the way, someone said there it only works with .js files.
I know that in the specification it says that jsw files are supported as well, but you should try having it in .js (Please let me know if it solved the problem).