client.defineJob({
  id: "delay-job",
  name: "Delay Job",
  version: "0.0.1",
  trigger: eventTrigger({
    name: "example.event",
  }),
  run: async (payload, io, ctx) => {
    await io.logger.info("Hi");

    // the second parameter is the number of seconds to wait
    await io.wait("wait 30 days", 30 * 24 * 60 * 60);

    await io.logger.info("Sorry for the slow reply!");
  },
});

These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.

Parameters

cacheKey
string
required

Should be a stable and unique cache key inside the run(). See resumability for more information.

seconds
number
required

The number of seconds to wait. This can be very long, serverless timeouts are not an issue.

Returns

A Promise that resolves after the specified amount of time.

client.defineJob({
  id: "delay-job",
  name: "Delay Job",
  version: "0.0.1",
  trigger: eventTrigger({
    name: "example.event",
  }),
  run: async (payload, io, ctx) => {
    await io.logger.info("Hi");

    // the second parameter is the number of seconds to wait
    await io.wait("wait 30 days", 30 * 24 * 60 * 60);

    await io.logger.info("Sorry for the slow reply!");
  },
});