import { task } from "@trigger.dev/sdk/v3";

export const parentTask = task({
  id: "parent-task",
  run: async (payload: { message: string }, { ctx }) => {
    
    if (ctx.environment.type === "DEVELOPMENT") {
      return;
    }
  },
});

Context (ctx) is a way to get information about a run.

The context object does not change whilst your code is executing. This means values like ctx.run.durationMs will be fixed at the moment the run() function is called.

import { task } from "@trigger.dev/sdk/v3";

export const parentTask = task({
  id: "parent-task",
  run: async (payload: { message: string }, { ctx }) => {
    
    if (ctx.environment.type === "DEVELOPMENT") {
      return;
    }
  },
});

Context properties

task
object
attempt
object
run
object
queue
object
environment
object
organization
object
project
object
batch
object

Optional information about the batch, if applicable.

machine
object

Optional information about the machine preset used for execution.