Skip to content

Docs – v4 GA updates #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fe1034a
Adds new features table to top of v4 upgrade guide
samejr Jul 21, 2025
1da6659
Adds wait idempotency to wait-until, wait-for, and wait-for-token pages
samejr Jul 21, 2025
c3b5150
Adds new priority docs page and updates the v4 upgrade guide
samejr Jul 21, 2025
022c598
Adds new task lifecycle hooks
samejr Jul 21, 2025
d8654bf
Removes the message about requiring tasks to be exported
samejr Jul 21, 2025
d756d6e
Adds new global lifecycle hooks section
samejr Jul 21, 2025
0098137
Moves sections from upgrade guide into the table
samejr Jul 21, 2025
8b25081
Adds hidden task page
samejr Jul 21, 2025
73bc0e7
Improves the global lifecycle hooks section
samejr Jul 21, 2025
46a334d
Updates middleware and locals section
samejr Jul 21, 2025
c067145
Adds new useWaitToken page to the react hooks section
samejr Jul 21, 2025
2ded6a5
Adds a new ai.tool section
samejr Jul 21, 2025
ca60eba
Moves Docker (legacy) page into self-hosting section
samejr Jul 22, 2025
d0530bf
Removes known issues from v4 upgrade guide
samejr Jul 22, 2025
33e7bde
Replace “toolTask” with “ai.tool” in the Streams page example
samejr Jul 22, 2025
9dc9d24
Renames guide to “Migrating from v3” and adds redirect
samejr Jul 22, 2025
8a4ae7c
Remove references to v4
samejr Jul 22, 2025
074ad78
Removes changelog from migration guide
samejr Jul 22, 2025
65d907f
The installation guide now references `@latest update`
samejr Jul 22, 2025
5c3b039
Changes all references from `/sdk/v3` to `/sdk`
samejr Jul 22, 2025
a494a67
Updates @v4-beta to @latest
samejr Jul 22, 2025
4737fc2
Fixed broken link
samejr Jul 22, 2025
34445d6
Fixes broken link
samejr Jul 22, 2025
9137dc4
Adds an upgrade to v4 using AI section
samejr Jul 22, 2025
9a74576
Fixes 2 broken links
samejr Jul 22, 2025
71ce3bf
Adds an entry for targetting preview branches
samejr Jul 23, 2025
1b9c4bd
Updates the run statuses
samejr Jul 23, 2025
78e1be3
Adds boolean helpers section to the runs and realtime pages
samejr Jul 23, 2025
83fe2b7
Updates the concurrency page
samejr Jul 23, 2025
f7ac047
Updates the test page to include the new options
samejr Jul 23, 2025
b8235ea
Adds SDK and curl options for the preview branch targeting
samejr Jul 23, 2025
d673235
Updates new bulk actions page
samejr Jul 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/apikeys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The default URL is `https://api.trigger.dev`.
If you prefer to manually configure the SDK, you can call the `configure` method:

```ts
import { configure } from "@trigger.dev/sdk/v3";
import { configure } from "@trigger.dev/sdk";
import { myTask } from "./trigger/myTasks";

configure({
Expand Down
41 changes: 25 additions & 16 deletions docs/bulk-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@ title: "Bulk actions"
description: "Perform actions like replay and cancel on multiple runs at once."
---

Bulk actions allow you to perform operations like replaying or canceling on multiple runs at once. This is especially useful when you need to retry a batch of failed runs with a new version of your code, or when you need to cancel multiple in-progress runs.

## Bulk replaying

You can replay multiple runs at once by selecting them from the table on the Runs page using the checkbox on the left hand side of the row. Then click the "Replay runs" button from the bulk action bar that appears at the bottom of the screen.

This is especially useful if you have lots of failed runs and want to run them all again. To do this, first filter the runs by the status you want, then select all the runs you want to replay and click the "Replay runs" button from the bulk action bar at the bottom of the page.
Bulk actions allow you to perform replaying and canceling on multiple runs at once. This is especially useful when you need to retry a batch of failed runs with a new version of your code, or when you need to cancel multiple in-progress runs.

<video
src="https://content.trigger.dev/bulk-replaying-runs.mp4"
src="https://content.trigger.dev/bulk-actions.mp4"
preload="auto"
controls={true}
loop
Expand All @@ -22,19 +16,34 @@ This is especially useful if you have lots of failed runs and want to run them a
height="100%"
/>

## Bulk canceling
## How to create a new bulk action

<Icon icon="circle-1" iconType="solid" color="#FF2D6B" size="20" /> Open the bulk action panel from the top right of the runs page

![Access bulk actions](/images/bulk-action-open-panel.png)


<Icon icon="circle-2" iconType="solid" color="#FF2D6B" size="20" /> Filter the runs table to show the runs you want to bulk action

<Icon icon="circle-3" iconType="solid" color="#FF2D6B" size="20" /> Alternatively, you can select individual runs

<Icon icon="circle-4" iconType="solid" color="#FF2D6B" size="20" /> Choose the runs you want to bulk action

<Icon icon="circle-5" iconType="solid" color="#FF2D6B" size="20" /> Name your bulk action (optional)

<Icon icon="circle-6" iconType="solid" color="#FF2D6B" size="20" /> Choose the action you want to perform, replay or cancel

<Icon icon="circle-7" iconType="solid" color="#FF2D6B" size="20" /> Click the "Replay" or "Cancel" button and confirm in the dialog

Similar to replaying multiple runs, you can cancel multiple runs at once. This is particularly useful when you have a batch of runs that you want to stop, perhaps because they were triggered with incorrect parameters or are no longer needed.
![Access bulk actions](/images/bulk-action-create.png)

To cancel multiple runs:
<Icon icon="circle-8" iconType="solid" color="#FF2D6B" size="20" /> You'll now view the bulk action processing from the bulk action page

1. Filter the runs table to show the runs you want to cancel (e.g., all runs with status "QUEUED" or "EXECUTING")
2. Use the checkboxes on the left side of the runs table to select the runs you want to cancel
3. Click the "Cancel runs" button in the bulk action bar that appears at the bottom of the screen
<Icon icon="circle-9" iconType="solid" color="#FF2D6B" size="20" /> You can replay or view the runs from this page

After confirming, all selected runs that can be canceled (those in appropriate states like QUEUED or EXECUTING) will be canceled. The status of these runs will change to "CANCELED" and they will not be resumed.
![Access bulk actions](/images/bulk-action-page.png)

<Note>
You can only cancel runs that are in states that allow cancellation (like QUEUED or EXECUTING).
Runs that are already completed, failed, or in other final states cannot be canceled.
Runs that are already completed, failed, or in other final states by the time the bulk action process gets to them, cannot be canceled.
</Note>
12 changes: 4 additions & 8 deletions docs/cli-preview-archive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
title: "CLI preview archive command"
sidebarTitle: "preview archive"
description: "The `trigger.dev preview archive` command can be used to archive a preview branch."
tag: "v4"
---

import UpgradeToV4Note from "/snippets/upgrade-to-v4-note.mdx";
import ProjectPathArg from "/snippets/cli-args-project-path.mdx";
import CommonOptions from "/snippets/cli-options-common.mdx";
import ProjectRefOption from "/snippets/cli-options-project-ref.mdx";
Expand All @@ -14,22 +12,20 @@ import ConfigFileOption from "/snippets/cli-options-config-file.mdx";
import SkipUpdateCheckOption from "/snippets/cli-options-skip-update-check.mdx";
import BranchOption from "/snippets/cli-options-branch.mdx";

<UpgradeToV4Note />

Run the command like this:

<CodeGroup>

```bash npm
npx trigger.dev@v4-beta preview archive
npx trigger.dev@latest preview archive
```

```bash pnpm
pnpm dlx trigger.dev@v4-beta preview archive
pnpm dlx trigger.dev@latest preview archive
```

```bash yarn
yarn dlx trigger.dev@v4-beta preview archive
yarn dlx trigger.dev@latest preview archive
```

</CodeGroup>
Expand All @@ -39,7 +35,7 @@ It will archive the preview branch, automatically detecting the branch name from
## Arguments

```
npx trigger.dev@v4-beta preview archive [path]
npx trigger.dev@latest preview archive [path]
```

<ProjectPathArg />
Expand Down
12 changes: 4 additions & 8 deletions docs/cli-switch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
title: "CLI switch command"
sidebarTitle: "switch"
description: "The `trigger.dev switch` command can be used to switch between profiles."
tag: "v4"
---

import UpgradeToV4Note from "/snippets/upgrade-to-v4-note.mdx";
import ProjectPathArg from "/snippets/cli-args-project-path.mdx";
import CommonOptions from "/snippets/cli-options-common.mdx";
import ProjectRefOption from "/snippets/cli-options-project-ref.mdx";
Expand All @@ -14,22 +12,20 @@ import ConfigFileOption from "/snippets/cli-options-config-file.mdx";
import SkipUpdateCheckOption from "/snippets/cli-options-skip-update-check.mdx";
import BranchOption from "/snippets/cli-options-branch.mdx";

<UpgradeToV4Note />

Run the command like this:

<CodeGroup>

```bash npm
npx trigger.dev@v4-beta switch [profile]
npx trigger.dev@latest switch [profile]
```

```bash pnpm
pnpm dlx trigger.dev@v4-beta switch [profile]
pnpm dlx trigger.dev@latest switch [profile]
```

```bash yarn
yarn dlx trigger.dev@v4-beta switch [profile]
yarn dlx trigger.dev@latest switch [profile]
```

</CodeGroup>
Expand All @@ -39,7 +35,7 @@ It will switch to the specified profile. If no profile is specified, it will lis
## Arguments

```
npx trigger.dev@v4-beta switch [profile]
npx trigger.dev@latest switch [profile]
```

<ParamField body="Profile" type="[profile]">
Expand Down
37 changes: 16 additions & 21 deletions docs/config/config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import NodeVersions from "/snippets/node-versions.mdx";
The `trigger.config.ts` file is used to configure your Trigger.dev project. It is a TypeScript file at the root of your project that exports a default configuration object. Here's an example:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
// Your project ref (you can see it on the Project settings page in the dashboard)
Expand Down Expand Up @@ -53,7 +53,7 @@ The config file handles a lot of things, like:
You can specify the directories where your tasks are located using the `dirs` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -66,7 +66,7 @@ If you omit the `dirs` option, we will automatically detect directories that are
We will search for TypeScript and JavaScript files in the specified directories and include them in the build process. We automatically exclude files that have `.test` or `.spec` in the name, but you can customize this by specifying glob patterns in the `ignorePatterns` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -80,7 +80,7 @@ export default defineConfig({
You can add lifecycle functions to get notified when any task starts, succeeds, or fails using `onStart`, `onSuccess` and `onFailure`:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand Down Expand Up @@ -111,7 +111,7 @@ We use OpenTelemetry (OTEL) for our run logs. This means you get a lot of inform
Here we add Prisma and OpenAI instrumentations to your `trigger.config.ts` file.

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { PrismaInstrumentation } from "@prisma/instrumentation";
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";

Expand Down Expand Up @@ -152,7 +152,7 @@ You can also configure custom telemetry exporters to send your traces and logs t
Then, configure the exporters in your `trigger.config.ts` file:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";

Expand Down Expand Up @@ -188,15 +188,10 @@ export default defineConfig({

Make sure to set the `AXIOM_API_TOKEN` and `AXIOM_DATASET` environment variables in your project.

<Note>
The `logExporters` option is available in the v4 beta SDK. See our [v4 upgrade
guide](/upgrade-to-v4) for more information.
</Note>

It's important to note that you cannot configure exporters using `OTEL_*` environment variables, as they would conflict with our internal telemetry. Instead you should configure the exporters via passing in arguments to the `OTLPTraceExporter` and `OTLPLogExporter` constructors. For example, here is how you can configure exporting to Honeycomb:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";

Expand Down Expand Up @@ -235,7 +230,7 @@ export default defineConfig({
We currently only officially support the `node` runtime, but you can try our experimental `bun` runtime by setting the `runtime` option in your config file:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -255,7 +250,7 @@ See our [Bun guide](/guides/frameworks/bun) for more information.
You can specify the default machine for all tasks in your project:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -271,7 +266,7 @@ See our [machines documentation](/machines) for more information.
You can set the log level for your project:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -287,7 +282,7 @@ The `logLevel` only determines which logs are sent to the Trigger.dev instance w
You can set the default `maxDuration` for all tasks in your project:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -303,7 +298,7 @@ See our [maxDuration guide](/runs/max-duration) for more information.
You can customize the build process using the `build` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -326,7 +321,7 @@ export default defineConfig({
All code is bundled by default, but you can exclude some packages from the bundle using the `external` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -342,7 +337,7 @@ When a package is excluded from the bundle, it will be added to a dynamically ge
Each entry in the external should be a package name, not necessarily the import path. For example, if you want to exclude the `ai` package, but you are importing `ai/rsc`, you should just include `ai` in the `external` array:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -363,7 +358,7 @@ export default defineConfig({
You can customize the `jsx` options that are passed to `esbuild` using the `jsx` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand All @@ -390,7 +385,7 @@ See the [esbuild JSX documentation](https://esbuild.github.io/content-types/#jsx
You can add custom [import conditions](https://esbuild.github.io/api/#conditions) to your build using the `conditions` option:

```ts trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand Down
2 changes: 1 addition & 1 deletion docs/config/extensions/additionalFiles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "Use the additionalFiles build extension to copy additional files t
Import the `additionalFiles` build extension and use it in your `trigger.config.ts` file:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { additionalFiles } from "@trigger.dev/build/extensions/core";

export default defineConfig({
Expand Down
4 changes: 2 additions & 2 deletions docs/config/extensions/additionalPackages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "Use the additionalPackages build extension to include additional p
Import the `additionalPackages` build extension and use it in your `trigger.config.ts` file:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { additionalPackages } from "@trigger.dev/build/extensions/core";

export default defineConfig({
Expand All @@ -22,7 +22,7 @@ export default defineConfig({
This allows you to include additional packages in the build that are not automatically included via imports. This is useful if you want to install a package that includes a CLI tool that you want to invoke in your tasks via `exec`. We will try to automatically resolve the version of the package but you can specify the version by using the `@` symbol:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand Down
4 changes: 2 additions & 2 deletions docs/config/extensions/aptGet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "Use the aptGet build extension to install system packages into the
You can install system packages into the deployed image using the `aptGet` extension:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { aptGet } from "@trigger.dev/build/extensions/core";

export default defineConfig({
Expand All @@ -22,7 +22,7 @@ export default defineConfig({
If you want to install a specific version of a package, you can specify the version like this:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
project: "<project ref>",
Expand Down
2 changes: 1 addition & 1 deletion docs/config/extensions/audioWaveform.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "Use the audioWaveform build extension to add support for Audio Wav
Previously, we installed [Audio Waveform](https://github.com/bbc/audiowaveform) in the build image. That's been moved to a build extension:

```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
import { defineConfig } from "@trigger.dev/sdk";
import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform";

export default defineConfig({
Expand Down
Loading