Context - Trigger.dev
Context (ctx) is a way to get information about a run.
Context properties
Hide properties
The exported function name of the task e.g. myTask if you defined it like this: export const myTask = task(...).
The file path of the task.
Show properties
The ID of the execution attempt.
The start time of the attempt.
The ID of the background worker.
The ID of the background worker task.
The current status of the attempt.
Show properties
The context of the task run.
An array of tags associated with the task run.
Whether this run is a replay of a previous run.
The creation time of the task run.
The start time of the task run.
The duration of the task run in milliseconds when the run() function is called. For live
values use the usage SDK functions.
The cost of the task run in cents when the run() function is called. For live values use the
usage SDK functions.
The base cost of the task run in cents when the run() function is called. For live values
use the usage SDK functions.
Show properties
The ID of the environment.
The slug of the environment.
The type of the environment (PRODUCTION, STAGING, DEVELOPMENT, or PREVIEW).
If the environment is PREVIEW then this will be the branch name.
Show properties
The name of the commit author.
The message of the commit.
Whether the commit is dirty, i.e. there are uncommitted changes.
The remote URL of the repository.
The number of the pull request.
The title of the pull request.
The state of the pull request (open, closed, or merged).
Show properties
The ID of the organization.
The slug of the organization.
The name of the organization.
Show properties
The reference of the project.
Optional information about the batch, if applicable.
Show properties
Optional information about the machine preset used for execution.
Show properties
The name of the machine preset.
The CPU allocation for the machine.
The memory allocation for the machine.
The cost in cents per millisecond for this machine preset.