Job Scheduler unable to find functions

i’ve set up a job scheduler that runs every hour a function but i can’t get it to work, no matter what function i try to execute i always get a “function not found” response. my JSON is valid and i’ve tried anything i could find on the official docs and on the forum as well. did i do something wrong or is this feature broken?

Live Monitoring’s Message


"jsonPayload":{"message":"["Error loading function from web module backend/Utils/WeekPresence: function 'loadJob' not found"]"
}
"severity":"ERROR"
"receiveTimestamp":"2020-12-28T16:00:28.208Z"

Jobs.config

// /backend/jobs.config
{
 "jobs": [
    {
 "functionLocation": "/Utils/WeekPresence.js(w)",
 "functionName": "loadJob",
 "description": "updates week's member presence",
 "executionConfig": {
 "cronExpression": "0 * * * *"
      }
    }
  ]
}

function i’m trying to call inside WeekPresence.js (keep in mind that it’s not really relevant as it can’t find any function i tell him to call but i included it in the post anyway for good measure)

function loadJob(){
    wixData.query("Roles")
    .find()
    .then( (results) => {
    jobLogger();
    databaseStoreTemp = results.items;
    updateWeekAction();
    })
}

Folder Structure

  1. Remove the comment from the top line.

  2. instead of

/Utils/WeekPresence.js(w)

Write:

/Utils/WeekPresence.js
  1. In the js file try to add “export”:
export function loadJob(){

it works! idk how to thank you, i’ve been banging my head at this thing all day and it was that simple

You’re welcome :slight_smile: