Jobs

Create and Schedule Jobs to Be Run On the Moralis Dapp.

Sometimes you want to execute long-running functions, and you don’t want to wait for a response. Cloud Jobs are meant for just that.

Define a Job

Define the job in your cloud functions.

    Moralis.Cloud.job("myJob", (request) =>  {
      // params: passed in the job call
      // headers: from the request that triggered the job
      // log: the Moralis Server logger passed in the request
      // message: a function to update the status message of the job object
      const { params, headers, log, message } = request;
      message("I just started");
      return doSomethingVeryLong(request);
    });

Schedule a Job

You can schedule a job in the "Jobs" section in the dashboard by clicking "Schedule a job" in the top right corner.

Pick a description, the job to run and provide parameters if needed

When you have configured your job, you confirm it by pressing "Schedule" in the bottom right corner.

Last updated