Jobs

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

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

Define a Job

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);
});

Scheduling 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.