From c1d149bf4bc471fcc1824658c571e5796d856c4a Mon Sep 17 00:00:00 2001 From: Jack Bridger Date: Tue, 17 Nov 2026 12:23:16 +0000 Subject: [PATCH 1/2] docs: fix wrong samples, stale versions and broken links Fix code samples that don't compile against the current SDK (missing maxDuration in configs, public token scopes as an array, completedAt on the Realtime run, redeclared batch handles, undefined payload fields, deduplicationKey on schedules.update, output on onComplete), move deprecated options to their replacements, correct the payload and Realtime connection limits, bump Node 20 and old CLI pins, drop Prisma 7 beta wording, and fix typos and links. --- docs/ai-chat/reference.mdx | 2 +- docs/cli-init-commands.mdx | 2 +- docs/config/extensions/prismaExtension.mdx | 14 ++++---- docs/deployment/preview-branches.mdx | 4 +-- docs/github-actions.mdx | 18 +++++----- docs/how-it-works.mdx | 9 +++-- docs/limits.mdx | 6 ++-- docs/management/overview.mdx | 2 +- docs/manual-setup.mdx | 10 +++--- docs/migrating-from-v3.mdx | 14 ++++---- docs/runs.mdx | 10 +++--- docs/snippets/node-versions.mdx | 1 + docs/tasks/overview.mdx | 2 +- docs/tasks/scheduled.mdx | 2 +- docs/tasks/schemaTask.mdx | 2 +- docs/triggering.mdx | 39 +++++++++++----------- docs/upgrading-packages.mdx | 4 +-- docs/video-walkthrough.mdx | 2 +- 18 files changed, 75 insertions(+), 68 deletions(-) diff --git a/docs/ai-chat/reference.mdx b/docs/ai-chat/reference.mdx index 8e9be6c8c7d..1365fbb08a6 100644 --- a/docs/ai-chat/reference.mdx +++ b/docs/ai-chat/reference.mdx @@ -9,7 +9,7 @@ description: "Complete API reference for the AI Agents SDK — backend options, | Dependency | Supported | Notes | |---|---|---| | `@trigger.dev/sdk` | `>=4.5.0` | The chat agent surface lives in this SDK release. Install with `@trigger.dev/sdk@latest`. | -| `ai` (Vercel AI SDK) | `^5.0.0 \|\| ^6.0.0 \|\| >=7.0.0-canary <8` | Declared as a peer. v6 is what we develop against day to day; v5 and v7 work too (v7 is in canary/beta upstream). Your installed `ai` major drives the chat surface's types. | +| `ai` (Vercel AI SDK) | `^5.0.0 \|\| ^6.0.0 \|\| >=7.0.0-canary <8` | Declared as a peer. v6 is what we develop against day to day; v5 and v7 work too. Your installed `ai` major drives the chat surface's types. | | `@ai-sdk/otel` | `1.x` (v7 only) | Optional. AI SDK 7 moved model-call span emission out of `ai` core into this adapter. Install it alongside `ai@7` and the SDK auto-registers it, so your model calls show up as spans in the run trace. Not needed on v5/v6, where `ai` core emits spans. See [AI SDK 7 telemetry](#ai-sdk-7-telemetry) below. | | `@ai-sdk/react` | matches your `ai` major | Pulled in by `useChat`. The transport works with whichever React hook ships in the same major as your `ai` version. | | `react` | `^18.0 \|\| ^19.0` | Required only if you use `@trigger.dev/sdk/chat/react` (the frontend transport). Server-only consumers can skip React entirely. | diff --git a/docs/cli-init-commands.mdx b/docs/cli-init-commands.mdx index d0c3b6f61a5..3c904ca924d 100644 --- a/docs/cli-init-commands.mdx +++ b/docs/cli-init-commands.mdx @@ -62,7 +62,7 @@ yarn dlx trigger.dev@latest init - The runtime to use: `node`, `node-22`, `node-24`, `node-26` or `bun`. Defaults to `node-24`. + The runtime to use: `node`, `node-22`, `node-24`, `node-26`, `bun-1.4` or `bun` (deprecated). Defaults to `node-24`. diff --git a/docs/config/extensions/prismaExtension.mdx b/docs/config/extensions/prismaExtension.mdx index d09875525f5..a3cb1ca4ec5 100644 --- a/docs/config/extensions/prismaExtension.mdx +++ b/docs/config/extensions/prismaExtension.mdx @@ -50,7 +50,7 @@ Use this decision tree to determine which mode is right for your project: ```mermaid flowchart TD - Start([Which mode should I use?]) --> Q1{Using Prisma 7 or
6.20+ beta?} + Start([Which mode should I use?]) --> Q1{Using Prisma 7?} Q1 -->|Yes| Modern[Modern Mode] Q1 -->|No| Q2{Using Prisma 6.16+
with engineType='client'?} Q2 -->|Yes| Modern @@ -210,7 +210,7 @@ prismaExtension({ - Designed for the new Prisma architecture - Zero configuration required - Automatically marks `@prisma/client` as external -- Works with Prisma 7 beta releases & Prisma 7 when released +- Works with Prisma 7 - You manage client generation (like engine-only mode) **Schema configuration (Prisma 6.16+ with engineType):** @@ -272,7 +272,7 @@ export default defineConfig({ **Important notes:** - You **must** run `prisma generate` yourself. -- Requires Prisma 6.16.0+ or Prisma 7 beta +- Requires Prisma 6.16.0+ or Prisma 7 - The new `prisma-client` provider generates plain TypeScript (no Rust binaries) - Requires database adapters (e.g., `@prisma/adapter-pg` for PostgreSQL) @@ -331,7 +331,7 @@ steps: - name: Generate Prisma client run: npx prisma@6.19.0 generate - name: Deploy Trigger.dev - run: npx trigger.dev@4.1.1 deploy --env prod + run: npx trigger.dev@latest deploy --env prod env: TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} ``` @@ -352,7 +352,7 @@ If you are using the [Trigger.dev Github integration](/github-integration), you | 5.0 - 6.15 | Legacy | Standard Prisma setup | | 6.7+ | Legacy | Multi-file schema support | | 6.16+ | Engine-only or Modern | Modern mode requires `engineType = "client"` | -| 6.20+ (7.0 beta) | Modern | Prisma 7 with new architecture | +| 7.0+ | Modern | Prisma 7 with new architecture | --- @@ -932,7 +932,7 @@ export const db = new PrismaClient({ --- -### Example 5: Prisma 7 beta (modern mode) +### Example 5: Prisma 7 (modern mode) **prisma/schema.prisma:** @@ -1008,6 +1008,6 @@ export const db = new PrismaClient({ adapter }); - [Prisma Documentation](https://www.prisma.io/docs) - [Multi-File Schema (Prisma 6.7+)](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema) - [TypedSQL (Prisma 5.19+)](https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/typedsql) -- [Prisma 7 Beta Documentation](https://www.prisma.io/docs) +- [Prisma 7 Documentation](https://www.prisma.io/docs) --- diff --git a/docs/deployment/preview-branches.mdx b/docs/deployment/preview-branches.mdx index e38bca2e6dc..643590fa2a1 100644 --- a/docs/deployment/preview-branches.mdx +++ b/docs/deployment/preview-branches.mdx @@ -115,10 +115,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.x + - name: Use Node.js 24.x uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "24.x" - name: Install dependencies run: npm install diff --git a/docs/github-actions.mdx b/docs/github-actions.mdx index b616174e363..6d3ce32ee59 100644 --- a/docs/github-actions.mdx +++ b/docs/github-actions.mdx @@ -35,10 +35,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.x + - name: Use Node.js 24.x uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "24.x" - name: Install dependencies run: npm install @@ -64,10 +64,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.x + - name: Use Node.js 24.x uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "24.x" - name: Install dependencies run: npm install @@ -124,10 +124,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.x + - name: Use Node.js 24.x uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "24.x" - name: Install dependencies run: npm install @@ -188,7 +188,7 @@ Tip: add the `trigger.dev` CLI to your `devDependencies` and the deploy command "deploy:trigger": "trigger deploy --env staging" }, "devDependencies": { - "trigger.dev": "4.7.0" + "trigger.dev": "4.8.5" } } ``` @@ -230,10 +230,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.x + - name: Use Node.js 24.x uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "24.x" - name: Install dependencies run: npm install diff --git a/docs/how-it-works.mdx b/docs/how-it-works.mdx index f549fd0fe51..f61419f8743 100644 --- a/docs/how-it-works.mdx +++ b/docs/how-it-works.mdx @@ -118,7 +118,7 @@ All these commands work with the Trigger.dev cloud and/or your self-hosted insta ```sh npx trigger.dev@latest login --profile -a https://trigger.example.com # Log in to a specific profile into a self-hosted instance -npx trigger.dev@latest dev --profile # Initialize Trigger.dev in your project +npx trigger.dev@latest dev --profile # Run your tasks locally npx trigger.dev@latest deploy --profile # Deploy your tasks to the Trigger.dev instance ``` @@ -408,7 +408,7 @@ When you run `npx trigger.dev@latest deploy` or `npx trigger.dev@latest dev`, we - **Bundled by default**: Code + dependencies are bundled and tree-shaked by default. - **Build extensions**: Use and write custom build extensions to transform your code or the resulting docker image. -- **ESM ouput**: We output to ESM, which allows tree-shaking and better performance. +- **ESM output**: We output to ESM, which allows tree-shaking and better performance. You can review the build output by running deploy with the `--dry-run` flag, which will output the Containerfile and the build output. @@ -451,6 +451,9 @@ import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk"; export default defineConfig({ project: "", - instrumentations: [new PrismaInstrumentation(), new AwsInstrumentation()], + maxDuration: 3600, + telemetry: { + instrumentations: [new PrismaInstrumentation(), new AwsInstrumentation()], + }, }); ``` diff --git a/docs/limits.mdx b/docs/limits.mdx index 7c0c6663477..5fa12e342bf 100644 --- a/docs/limits.mdx +++ b/docs/limits.mdx @@ -107,10 +107,10 @@ Additional bundles above the Pro tier are available for $10/month per preview br | Pricing tier | Limit | | :----------- | :-------------------------- | | Free | 10 concurrent connections | -| Hobby | 50 concurrent connections | -| Pro | 500+ concurrent connections | +| Hobby | 150 concurrent connections | +| Pro | 1,000+ concurrent connections | -Additional bundles are available for $10/month per 100 concurrent connections. Contact us via [email](https://trigger.dev/contact) or [Discord](https://trigger.dev/discord) to request more. +Additional bundles are available for $10/month per 1,000 concurrent connections. Contact us via [email](https://trigger.dev/contact) or [Discord](https://trigger.dev/discord) to request more. ## Task payloads and outputs diff --git a/docs/management/overview.mdx b/docs/management/overview.mdx index e94d5e57c9b..df2ff24c72e 100644 --- a/docs/management/overview.mdx +++ b/docs/management/overview.mdx @@ -26,7 +26,7 @@ yarn add @trigger.dev/sdk@latest ## Usage -All `v3` functionality is provided through the `@trigger.dev/sdk` module. You can import the entire module or individual resources as needed. +All functionality is provided through the `@trigger.dev/sdk` module. You can import the entire module or individual resources as needed. ```ts import { configure, runs } from "@trigger.dev/sdk"; diff --git a/docs/manual-setup.mdx b/docs/manual-setup.mdx index 21606ed3061..56233db74e2 100644 --- a/docs/manual-setup.mdx +++ b/docs/manual-setup.mdx @@ -146,7 +146,7 @@ export default defineConfig({ // Retry configuration retries: { - enabledInDev: false, // Enable retries in development + enabledInDev: true, // Enable retries in development default: { maxAttempts: 3, minTimeoutInMs: 1000, @@ -175,7 +175,8 @@ import { defineConfig } from "@trigger.dev/sdk"; export default defineConfig({ project: "", - runtime: "bun", + maxDuration: 3600, + runtime: "bun-1.4", dirs: ["./src/trigger"], }); ``` @@ -261,7 +262,7 @@ import { auth } from "@trigger.dev/sdk"; // In your backend API export async function getPublicAccessToken() { const publicAccessToken = await auth.createPublicToken({ - scopes: ["read:runs"], // Customize based on needs + scopes: { read: { runs: true } }, // Customize based on needs }); return publicAccessToken; @@ -290,7 +291,7 @@ export function TaskStatus({ return (

Status: {run.status}

-

Progress: {run.completedAt ? "Complete" : "Running..."}

+

Progress: {run.isCompleted ? "Complete" : "Running..."}

); } @@ -310,6 +311,7 @@ import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; export default defineConfig({ project: "", + maxDuration: 3600, build: { extensions: [ prismaExtension({ diff --git a/docs/migrating-from-v3.mdx b/docs/migrating-from-v3.mdx index 1248b626cfe..07b985382af 100644 --- a/docs/migrating-from-v3.mdx +++ b/docs/migrating-from-v3.mdx @@ -30,7 +30,7 @@ Trigger.dev v3 is end of life. v4 is stable, fully supported, and recommended fo | [onComplete](/tasks/overview#oncomplete-function) | Run code when a run completes, regardless of whether it succeeded or failed. | | [onCancel](/tasks/overview#oncancel-function) | Run code when a run is cancelled. | | [Hidden tasks](/hidden-tasks) | Create tasks that are not exported from your trigger files but can still be executed. | -| [Middleware & locals](#middleware-and-locals) | The middleware system runs at the top level, executing before and after all lifecycle hooks. The locals API allows sharing data between middleware and hooks. | +| [Middleware & locals](/tasks/overview#middleware-and-locals-functions) | The middleware system runs at the top level, executing before and after all lifecycle hooks. The locals API allows sharing data between middleware and hooks. | | [useWaitToken](/realtime/react-hooks/use-wait-token) | Use the useWaitToken hook to complete a wait token from a React component. | | [Task-backed AI tools](/tasks/schemaTask#task-backed-ai-tools) | Use `schemaTask` with AI SDK `tool()` and `ai.toolExecute()` (legacy `ai.tool` is deprecated). | @@ -260,7 +260,7 @@ import { task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", - onStart: ({ payload, ctx }) => {}, + onStartAttempt: ({ payload, ctx }) => {}, // The run function still uses separate parameters run: async (payload, { ctx }) => {}, }); @@ -273,7 +273,7 @@ import { task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", - onStart: ({ payload, ctx, task }) => {}, + onStartAttempt: ({ payload, ctx, task }) => {}, onSuccess: ({ payload, ctx, task, output }) => {}, onFailure: ({ payload, ctx, task, error }) => {}, onWait: ({ payload, ctx, task, wait }) => {}, @@ -326,7 +326,7 @@ We are now using newer versions of the OpenTelemetry packages. This means that i | Package | Previous Version | New Version | Change Type | | ----------------------------------------- | ---------------- | ----------- | ------------ | -| `@opentelemetry/api-logs` | 0.52.1 | 0.203.0 | Major update | -| `@opentelemetry/exporter-logs-otlp-http` | 0.52.1 | 0.203.0 | Major update | -| `@opentelemetry/exporter-trace-otlp-http` | 0.52.1 | 0.203.0 | Major update | -| `@opentelemetry/instrumentation` | 0.52.1 | 0.203.0 | Major update | +| `@opentelemetry/api-logs` | 0.52.1 | 0.219.0 | Major update | +| `@opentelemetry/exporter-logs-otlp-http` | 0.52.1 | 0.219.0 | Major update | +| `@opentelemetry/exporter-trace-otlp-http` | 0.52.1 | 0.219.0 | Major update | +| `@opentelemetry/instrumentation` | 0.52.1 | 0.219.0 | Major update | diff --git a/docs/runs.mdx b/docs/runs.mdx index 3e861b9652e..c28f8c065a7 100644 --- a/docs/runs.mdx +++ b/docs/runs.mdx @@ -143,13 +143,13 @@ await runs.cancel(runId); When a run is canceled: -– The task execution is stopped +- The task execution is stopped -– The run is marked as canceled +- The run is marked as canceled -– The task will not be retried +- The task will not be retried -– Any in-progress child runs are also canceled +- Any in-progress child runs are also canceled ### Time-to-live (TTL) @@ -398,7 +398,7 @@ for await (const run of runs.subscribeToRun(runId)) { } ``` -For more on real-time updates, see the [Realtime](/realtime) documentation. +For more on real-time updates, see the [Realtime](/realtime/overview) documentation. ### Triggering runs for undeployed tasks diff --git a/docs/snippets/node-versions.mdx b/docs/snippets/node-versions.mdx index 92e3fc5597a..e10d7a4784a 100644 --- a/docs/snippets/node-versions.mdx +++ b/docs/snippets/node-versions.mdx @@ -16,5 +16,6 @@ export default defineConfig({ // "node", "node-22", "node-24", "node-26", "bun" or "bun-1.4" runtime: "node-24", project: "", + maxDuration: 3600, }); ``` diff --git a/docs/tasks/overview.mdx b/docs/tasks/overview.mdx index 9d287a93334..31e588b6ebf 100644 --- a/docs/tasks/overview.mdx +++ b/docs/tasks/overview.mdx @@ -428,7 +428,7 @@ You can also define a global `onComplete` function using `tasks.onComplete()`. ```ts init.ts import { tasks } from "@trigger.dev/sdk"; -tasks.onComplete(({ ctx, payload, output }) => { +tasks.onComplete(({ ctx, payload, result }) => { console.log("Task completed", ctx.task.id); }); ``` diff --git a/docs/tasks/scheduled.mdx b/docs/tasks/scheduled.mdx index b5e8a957d0e..71acf1c9049 100644 --- a/docs/tasks/scheduled.mdx +++ b/docs/tasks/scheduled.mdx @@ -57,6 +57,7 @@ You can see from the comments that the payload has several useful properties: - `lastTimestamp` - the time the task was last run, as a UTC date. - `timezone` - the timezone the schedule was registered with, defaults to "UTC". In IANA format, e.g. "America/New_York". - `scheduleId` - the id of the schedule that triggered the task +- `type` - the type of schedule, either "DECLARATIVE" (defined with the `cron` property on your task) or "IMPERATIVE" (created with `schedules.create` or in the dashboard) - `externalId` - the external id you (optionally) provided when creating the schedule - `upcoming` - the next 10 times the task is scheduled to run @@ -438,7 +439,6 @@ const updatedSchedule = await schedules.update(scheduleId, { task: firstScheduledTask.id, cron: "0 0 1 * *", externalId: "ext_1234444", - deduplicationKey: "my-deduplication-key", }); ``` diff --git a/docs/tasks/schemaTask.mdx b/docs/tasks/schemaTask.mdx index a551fb1af49..1dc20789411 100644 --- a/docs/tasks/schemaTask.mdx +++ b/docs/tasks/schemaTask.mdx @@ -24,7 +24,7 @@ const myTask = schemaTask({ }); ``` -`schemaTask` takes all the same options as [task](/tasks/overview), with the addition of a `schema` field. The `schema` field is a schema parser function from a schema library or or a custom parser function. +`schemaTask` takes all the same options as [task](/tasks/overview), with the addition of a `schema` field. The `schema` field is a schema parser function from a schema library or a custom parser function. We will probably eventually combine `task` and `schemaTask` into a single function, but because diff --git a/docs/triggering.mdx b/docs/triggering.mdx index 6ca886cc263..8f98670094e 100644 --- a/docs/triggering.mdx +++ b/docs/triggering.mdx @@ -13,7 +13,7 @@ Trigger tasks **from your backend**: | `tasks.batchTrigger()` | Triggers a single task in a batch and returns a handle you can use to fetch and manage the runs. | [Docs](#tasks-batchtrigger) | | `batch.trigger()` | Similar to `tasks.batchTrigger` but allows running multiple different tasks | [Docs](#batch-trigger) | -Trigger tasks **from inside a another task**: +Trigger tasks **from inside another task**: | Function | What it does | | | :------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | @@ -23,7 +23,7 @@ Trigger tasks **from inside a another task**: | `yourTask.batchTriggerAndWait()` | Triggers a task multiple times in parallel and then waits until they're all complete. You get the resulting data to continue with. | [Docs](#yourtask-batchtriggerandwait) | | `batch.triggerAndWait()` | Similar to `batch.trigger` but will wait on the triggered tasks to finish and return the results. | [Docs](#batch-triggerandwait) | | `batch.triggerByTask()` | Similar to `batch.trigger` but allows passing in task instances instead of task IDs. | [Docs](#batch-triggerbytask) | -| `batch.triggerByTaskAndWait()` | Similar to `batch.triggerbyTask` but will wait on the triggered tasks to finish and return the results. | [Docs](#batch-triggerbytaskandwait) | +| `batch.triggerByTaskAndWait()` | Similar to `batch.triggerByTask` but will wait on the triggered tasks to finish and return the results. | [Docs](#batch-triggerbytaskandwait) | ## Triggering from your backend @@ -204,7 +204,7 @@ Triggers a single run of a task with the payload you pass in, and any options yo If you need to call `trigger()` on a task in a loop, use - [`batchTrigger()`](#yourTask-batchtrigger) instead which will trigger up to 1,000 runs in a single + [`batchTrigger()`](#yourtask-batchtrigger) instead which will trigger up to 1,000 runs in a single call with SDK 4.3.1+ (500 runs in prior versions). @@ -254,7 +254,7 @@ export const myTask = task({ const batchHandle = await myOtherTask.batchTrigger([{ payload: "some data" }]); //...do other stuff - const batch = await batch.retrieve(batchHandle.id); + const batchRun = await batch.retrieve(batchHandle.batchId); }, }); ``` @@ -273,7 +273,7 @@ export const myTask = task({ }); //...do other stuff - const batch = await batch.retrieve(batchHandle.id); + const batchRun = await batch.retrieve(batchHandle.batchId); }, }); ``` @@ -292,7 +292,7 @@ export const myTask = task({ ]); //...do other stuff - const batch = await batch.retrieve(batchHandle.id); + const batchRun = await batch.retrieve(batchHandle.batchId); }, }); ``` @@ -568,14 +568,14 @@ export const parentTask = task({ export const childTask1 = task({ id: "child-task-1", run: async (payload: { foo: string }) => { - return `Hello ${payload}`; + return `Hello ${payload.foo}`; }, }); export const childTask2 = task({ id: "child-task-2", run: async (payload: { bar: number }) => { - return bar + 1; + return payload.bar + 1; }, }); ``` @@ -604,14 +604,14 @@ export const parentTask = task({ export const childTask1 = task({ id: "child-task-1", run: async (payload: { foo: string }) => { - return `Hello ${payload}`; + return `Hello ${payload.foo}`; }, }); export const childTask2 = task({ id: "child-task-2", run: async (payload: { bar: number }) => { - return bar + 1; + return payload.bar + 1; }, }); ``` @@ -660,14 +660,14 @@ export const parentTask = task({ export const childTask1 = task({ id: "child-task-1", run: async (payload: { foo: string }) => { - return `Hello ${payload}`; + return `Hello ${payload.foo}`; }, }); export const childTask2 = task({ id: "child-task-2", run: async (payload: { bar: number }) => { - return bar + 1; + return payload.bar + 1; }, }); ``` @@ -700,11 +700,11 @@ await myTask.trigger({ some: "data" }, { delay: "88s" }); // Delay the task run by 1 hour and 52 minutes and 18 seconds await myTask.trigger({ some: "data" }, { delay: "1h52m18s" }); // Delay until a specific time -await myTask.trigger({ some: "data" }, { delay: "2024-12-01T00:00:00" }); +await myTask.trigger({ some: "data" }, { delay: "2030-12-01T00:00:00" }); // Delay using a Date object await myTask.trigger({ some: "data" }, { delay: new Date(Date.now() + 1000 * 60 * 60) }); // Delay using a timezone -await myTask.trigger({ some: "data" }, { delay: new Date("2024-07-23T11:50:00+02:00") }); +await myTask.trigger({ some: "data" }, { delay: new Date("2030-07-23T11:50:00+02:00") }); ``` Runs that are delayed and have not been enqueued yet will display in the dashboard with a "Delayed" status: @@ -1128,7 +1128,7 @@ await yourTask.trigger(payload, { region: "eu-central-1" }); If you don't specify a region it will use the default for your project. Go to the "Regions" page in the dashboard to see available regions or switch your default. Static IP addresses are also available on the Regions page for paid plans. -The region is where your runs are executed, it does not change where the run payload, output, tags, logs, or are any other data is stored. +The region is where your runs are executed, it does not change where the run payload, output, tags, logs, or any other data is stored. ### `machine` @@ -1186,9 +1186,10 @@ When batch triggering fails, the SDK throws a `BatchTriggerError` with propertie | :--- | :--- | :--- | | `isRateLimited` | `boolean` | `true` if the error was caused by rate limiting | | `retryAfterMs` | `number \| undefined` | Milliseconds until the rate limit resets | -| `phase` | `"create" \| "stream"` | Which phase of batch creation failed | +| `phase` | `"offload" \| "create" \| "stream"` | Which phase of batch creation failed | | `batchId` | `string \| undefined` | The batch ID if it was created before failure | | `itemCount` | `number` | Number of items attempted in the batch | +| `apiError` | `ApiError \| undefined` | The underlying API error, if the cause was an `ApiError` | | `cause` | `unknown` | The underlying error | ### Detecting and handling rate limits @@ -1262,7 +1263,7 @@ export const parentTask = task({ ## Large Payloads -We recommend keeping your task payloads as small as possible. We currently have a hard limit on task payloads above 10MB. +We recommend keeping your task payloads as small as possible. Task payloads must not exceed 3MB (see [Limits](/limits#task-payloads-and-outputs)). If your payload size is larger than 512KB, instead of saving the payload to the database, we will upload it to an S3-compatible object store and store the URL in the database. @@ -1286,7 +1287,7 @@ if (run.payloadPresignedUrl) { corresponding `outputPresignedUrl`. Task outputs are limited to 100MB. -If you need to pass larger payloads, you'll need to upload the payload to your own storage and pass a URL to the file in the payload instead. For example, uploading to S3 and then sending a presigned URL that expires in URL: +If you need to pass larger payloads, you'll need to upload the payload to your own storage and pass a URL to the file in the payload instead. For example, uploading to S3 and then sending a presigned URL that expires in 1 hour: @@ -1299,7 +1300,7 @@ import { createReadStream } from "node:fs"; await s3Client.send( new PutObjectCommand({ Bucket: "my-bucket", - Key: "myfile.json", + Key: "my-file.json", Body: createReadStream("large-payload.json"), }) ); diff --git a/docs/upgrading-packages.mdx b/docs/upgrading-packages.mdx index dd896051fa7..62c61bbdc7c 100644 --- a/docs/upgrading-packages.mdx +++ b/docs/upgrading-packages.mdx @@ -44,7 +44,7 @@ You can deploy using [GitHub Actions](/github-actions). We recommend that you lo In the steps you'll see a `run` command. It will run the trigger.dev deploy CLI command. Make - sure to update this version to the latest version (e.g. `npx trigger.dev@4.7.3 deploy`). + sure to update this version to the latest version (e.g. `npx trigger.dev@4.8.5 deploy`). @@ -57,7 +57,7 @@ For example: ```json { "devDependencies": { - "trigger.dev": "4.7.3" + "trigger.dev": "4.8.5" } } ``` diff --git a/docs/video-walkthrough.mdx b/docs/video-walkthrough.mdx index e8731cf5424..97b05263335 100644 --- a/docs/video-walkthrough.mdx +++ b/docs/video-walkthrough.mdx @@ -19,5 +19,5 @@ description: "Go from zero to a working task in your Next.js app in 10 minutes." - [0:00](https://youtu.be/YH_4c0K7fGM?si=J8svVzotZtyTXDap&t=0) – [Install Trigger.dev](/quick-start) in an existing Next.js project - [1:44](https://youtu.be/YH_4c0K7fGM?si=J8svVzotZtyTXDap&t=104) – [Run and test](/run-tests) the "Hello, world!" example project - [2:09](https://youtu.be/YH_4c0K7fGM?si=FMTP8ep_cDBCU0_x&t=128) – Create and run an AI image generation task that uses [Fal.ai](https://fal.ai) – ([View the code](/guides/examples/fal-ai-image-to-cartoon)) -- [6:25](https://youtu.be/YH_4c0K7fGM?si=pPc8iLI2Y9FGD3yo&t=385) – Create and run a [Realtime](/realtime/overview) example using [React hooks](/realtime/react-hooks) – ([View the code](/guides/examples/fal-ai-realtime)) +- [6:25](https://youtu.be/YH_4c0K7fGM?si=pPc8iLI2Y9FGD3yo&t=385) – Create and run a [Realtime](/realtime/overview) example using [React hooks](/realtime/react-hooks/overview) – ([View the code](/guides/examples/fal-ai-realtime)) - [11:10](https://youtu.be/YH_4c0K7fGM?si=Mjd0EvvNsNlVouvY&t=670) – [Deploy your task](/cli-deploy-commands) to the Trigger.dev Cloud From c565d9e41d5e8f5ab9a444d406699c43da5138d9 Mon Sep 17 00:00:00 2001 From: Jack Bridger Date: Tue, 17 Nov 2026 13:01:16 +0000 Subject: [PATCH 2/2] docs: note onStartAttempt runs per attempt, scope the example token to one run --- docs/config/extensions/prismaExtension.mdx | 2 +- docs/manual-setup.mdx | 6 +++--- docs/migrating-from-v3.mdx | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/config/extensions/prismaExtension.mdx b/docs/config/extensions/prismaExtension.mdx index a3cb1ca4ec5..78da4718252 100644 --- a/docs/config/extensions/prismaExtension.mdx +++ b/docs/config/extensions/prismaExtension.mdx @@ -932,7 +932,7 @@ export const db = new PrismaClient({ --- -### Example 5: Prisma 7 (modern mode) +### Example 5: Prisma 7 beta (modern mode) **prisma/schema.prisma:** diff --git a/docs/manual-setup.mdx b/docs/manual-setup.mdx index 56233db74e2..cde8369059f 100644 --- a/docs/manual-setup.mdx +++ b/docs/manual-setup.mdx @@ -259,10 +259,10 @@ bun add @trigger.dev/react-hooks@latest ```typescript import { auth } from "@trigger.dev/sdk"; -// In your backend API -export async function getPublicAccessToken() { +// In your backend API, after checking the user can access this run +export async function getPublicAccessToken(runId: string) { const publicAccessToken = await auth.createPublicToken({ - scopes: { read: { runs: true } }, // Customize based on needs + scopes: { read: { runs: [runId] } }, // Only this run }); return publicAccessToken; diff --git a/docs/migrating-from-v3.mdx b/docs/migrating-from-v3.mdx index 07b985382af..8c874d39274 100644 --- a/docs/migrating-from-v3.mdx +++ b/docs/migrating-from-v3.mdx @@ -266,6 +266,10 @@ export const myTask = task({ }); ``` + + `onStart` is deprecated in favor of `onStartAttempt`. `onStart` ran once per run, but `onStartAttempt` runs before every attempt, including retries. If your hook has side effects that should only happen once, check `ctx.attempt.number === 1` inside it. + + This is true for all the lifecycle hooks: ```ts