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

1
Moralis.Cloud.job("myJob", (request) => {
2
// params: passed in the job call
3
// headers: from the request that triggered the job
4
// log: the Moralis Server logger passed in the request
5
// message: a function to update the status message of the job object
6
const { params, headers, log, message } = request;
7
message("I just started");
8
return doSomethingVeryLong(request);
9
});
Copied!

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.
Last modified 3mo ago