Docs – v4 GA updates (#2298)

* Adds new features table to top of v4 upgrade guide

* Adds wait idempotency to wait-until, wait-for, and wait-for-token pages

* Adds new priority docs page and updates the v4 upgrade guide

* Adds new task lifecycle hooks

* Removes the message about requiring tasks to be exported

* Adds new global lifecycle hooks section

* Moves sections from upgrade guide into the table

* Adds hidden task page

* Improves the global lifecycle hooks section

* Updates middleware and locals section

* Adds new useWaitToken page to the react hooks section

* Adds a new ai.tool section

* Moves Docker (legacy) page into self-hosting section

* Removes known issues from v4 upgrade guide

* Replace “toolTask” with “ai.tool” in the Streams page example

* Renames guide to “Migrating from v3” and adds redirect

* Remove references to v4

* Removes changelog from migration guide

* The installation guide now references `@latest update`

* Changes all references from `/sdk/v3` to `/sdk`

* Updates @v4-beta to @latest

* Fixed broken link

* Fixes broken link

* Adds an upgrade to v4 using AI section

* Fixes 2 broken links

* Adds an entry for targetting preview branches

* Updates the run statuses

* Adds boolean helpers section to the runs and realtime pages

* Updates the concurrency page

* Updates the test page to include the new options

* Adds SDK and curl options for the preview branch targeting

* Updates new bulk actions page

* Remove the releasing concurrency section

* Got rid of some more @v4-beta mentions

* Improved rate limit docs

* Improved migrating docs

* Removed commented sections of the docs

* useWaitToken hook

* Fixed the description

* Fix for missing test image

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
Co-authored-by: Dan <8297864+D-K-P@users.noreply.github.com>
This commit is contained in:
James Ritchie
2025-08-18 12:34:55 +01:00
committed by GitHub
parent 78af477efc
commit fade22015f
127 changed files with 1668 additions and 606 deletions
+25 -21
View File
@@ -45,7 +45,7 @@ Triggers a single run of a task with the payload you pass in, and any options yo
</Note>
```ts Your backend
import { tasks } from "@trigger.dev/sdk/v3";
import { tasks } from "@trigger.dev/sdk";
import type { emailSequence } from "~/trigger/emails";
// 👆 **type-only** import
@@ -68,7 +68,7 @@ export async function POST(request: Request) {
You can pass in options to the task using the second argument:
```ts Your backend
import { tasks } from "@trigger.dev/sdk/v3";
import { tasks } from "@trigger.dev/sdk";
import type { emailSequence } from "~/trigger/emails";
//app/email/route.ts
@@ -96,7 +96,7 @@ export async function POST(request: Request) {
Triggers multiple runs of a single task with the payloads you pass in, and any options you specify, without needing to import the task.
```ts Your backend
import { tasks } from "@trigger.dev/sdk/v3";
import { tasks } from "@trigger.dev/sdk";
import type { emailSequence } from "~/trigger/emails";
// 👆 **type-only** import
@@ -119,7 +119,7 @@ export async function POST(request: Request) {
You can pass in options to the `batchTrigger` function using the second argument:
```ts Your backend
import { tasks } from "@trigger.dev/sdk/v3";
import { tasks } from "@trigger.dev/sdk";
import type { emailSequence } from "~/trigger/emails";
//app/email/route.ts
@@ -142,7 +142,7 @@ export async function POST(request: Request) {
You can also pass in options for each run in the batch:
```ts Your backend
import { tasks } from "@trigger.dev/sdk/v3";
import { tasks } from "@trigger.dev/sdk";
import type { emailSequence } from "~/trigger/emails";
//app/email/route.ts
@@ -166,7 +166,7 @@ export async function POST(request: Request) {
Triggers multiple runs of different tasks with the payloads you pass in, and any options you specify. This is useful when you need to trigger multiple tasks at once.
```ts Your backend
import { batch } from "@trigger.dev/sdk/v3";
import { batch } from "@trigger.dev/sdk";
import type { myTask1, myTask2 } from "~/trigger/myTasks";
export async function POST(request: Request) {
@@ -203,7 +203,7 @@ Triggers a single run of a task with the payload you pass in, and any options yo
</Note>
```ts ./trigger/my-task.ts
import { runs } from "@trigger.dev/sdk/v3";
import { runs } from "@trigger.dev/sdk";
import { myOtherTask } from "~/trigger/my-other-task";
export const myTask = task({
@@ -220,7 +220,7 @@ export const myTask = task({
To pass options to the triggered task, you can use the second argument:
```ts ./trigger/my-task.ts
import { runs } from "@trigger.dev/sdk/v3";
import { runs } from "@trigger.dev/sdk";
import { myOtherTask } from "~/trigger/my-other-task";
export const myTask = task({
@@ -239,7 +239,7 @@ export const myTask = task({
Triggers multiple runs of a single task with the payloads you pass in, and any options you specify.
```ts /trigger/my-task.ts
import { batch } from "@trigger.dev/sdk/v3";
import { batch } from "@trigger.dev/sdk";
import { myOtherTask } from "~/trigger/my-other-task";
export const myTask = task({
@@ -256,7 +256,7 @@ export const myTask = task({
If you need to pass options to `batchTrigger`, you can use the second argument:
```ts /trigger/my-task.ts
import { batch } from "@trigger.dev/sdk/v3";
import { batch } from "@trigger.dev/sdk";
import { myOtherTask } from "~/trigger/my-other-task";
export const myTask = task({
@@ -275,7 +275,7 @@ export const myTask = task({
You can also pass in options for each run in the batch:
```ts /trigger/my-task.ts
import { batch } from "@trigger.dev/sdk/v3";
import { batch } from "@trigger.dev/sdk";
import { myOtherTask } from "~/trigger/my-other-task";
export const myTask = task({
@@ -381,7 +381,7 @@ export const parentTask = task({
You can also catch the error if the child task fails and get more information about the error:
```ts /trigger/parent.ts
import { task, SubtaskUnwrapError } from "@trigger.dev/sdk/v3";
import { task, SubtaskUnwrapError } from "@trigger.dev/sdk";
export const parentTask = task({
id: "parent-task",
run: async (payload: string) => {
@@ -530,7 +530,7 @@ export const batchParentTask = task({
You can batch trigger multiple different tasks and wait for all the results:
```ts /trigger/batch.ts
import { batch, task } from "@trigger.dev/sdk/v3";
import { batch, task } from "@trigger.dev/sdk";
export const parentTask = task({
id: "parent-task",
@@ -579,7 +579,7 @@ export const childTask2 = task({
You can batch trigger multiple different tasks by passing in the task instances. This function is especially useful when you have a static set of tasks you want to trigger:
```ts /trigger/batch.ts
import { batch, task, runs } from "@trigger.dev/sdk/v3";
import { batch, task, runs } from "@trigger.dev/sdk";
export const parentTask = task({
id: "parent-task",
@@ -615,7 +615,7 @@ export const childTask2 = task({
You can batch trigger multiple different tasks by passing in the task instances, and wait for all the results. This function is especially useful when you have a static set of tasks you want to trigger:
```ts /trigger/batch.ts
import { batch, task, runs } from "@trigger.dev/sdk/v3";
import { batch, task, runs } from "@trigger.dev/sdk";
export const parentTask = task({
id: "parent-task",
@@ -713,7 +713,7 @@ Runs that are delayed and have not been enqueued yet will display in the dashboa
You can cancel a delayed run using the `runs.cancel` SDK function:
```ts
import { runs } from "@trigger.dev/sdk/v3";
import { runs } from "@trigger.dev/sdk";
await runs.cancel("run_1234");
```
@@ -721,7 +721,7 @@ await runs.cancel("run_1234");
You can also reschedule a delayed run using the `runs.reschedule` SDK function:
```ts
import { runs } from "@trigger.dev/sdk/v3";
import { runs } from "@trigger.dev/sdk";
// The delay option here takes the same format as the trigger delay option
await runs.reschedule("run_1234", { delay: "1h" });
@@ -778,7 +778,7 @@ For this reason, the `ttl` option only accepts durations and not absolute timest
You can provide an `idempotencyKey` to ensure that a task is only triggered once with the same key. This is useful if you are triggering a task within another task that might be retried:
```typescript
import { idempotencyKeys, task } from "@trigger.dev/sdk/v3";
import { idempotencyKeys, task } from "@trigger.dev/sdk";
export const myTask = task({
id: "my-task",
@@ -810,7 +810,7 @@ For more information, see our [Idempotency](/idempotency) documentation.
Idempotency keys automatically expire after 30 days, but you can set a custom TTL for an idempotency key when triggering a task:
```typescript
import { idempotencyKeys, task } from "@trigger.dev/sdk/v3";
import { idempotencyKeys, task } from "@trigger.dev/sdk";
export const myTask = task({
id: "my-task",
@@ -945,6 +945,10 @@ View our [metadata doc](/runs/metadata) for more information.
View our [maxDuration doc](/runs/max-duration) for more information.
### `priority`
View our [priority doc](/runs/priority) for more information.
### `region`
You can override the default region when you trigger a run:
@@ -966,7 +970,7 @@ If your payload size is larger than 512KB, instead of saving the payload to the
When your task runs, we automatically download the payload from the object store and pass it to your task function. We also will return to you a `payloadPresignedUrl` from the `runs.retrieve` SDK function so you can download the payload if needed:
```ts
import { runs } from "@trigger.dev/sdk/v3";
import { runs } from "@trigger.dev/sdk";
const run = await runs.retrieve(handle);
@@ -1020,7 +1024,7 @@ const handle = await myTask.trigger({
```
```ts /trigger/myTasks.ts
import { task } from "@trigger.dev/sdk/v3";
import { task } from "@trigger.dev/sdk";
export const myTask = task({
id: "my-task",