@trigger.dev/sdk
4.8.8 · 20 Nov 2026MIT1.7M / weekRepositoryHomepagenpmAtom feed
3.3.17 is the newest release of 3.x.
In short
2 breaking12 new32 fixed1 internal
- Breaking
Release 3.0.0
- Breaking
Updates to support Trigger.dev v3
Release note
The section about @trigger.dev/sdk of a note shared by several packages.
Major Changes
- Breaking
Release 3.0.0
- Breaking
Updates to support Trigger.dev v3
Patch Changes
Add machine config and secure zod connection
Implement task.onSuccess/onFailure and config.onSuccess/onFailure
Configurable log levels in the config file and via env var
Fixes for continuing after waits
New Build System
Fix trigger functions for custom queues
v3: Environment variable management API and SDK, along with resolveEnvVars CLI hook
Fix return type of runs.retrieve, and allow passing the type of the task to runs.retrieve
Make msw a normal dependency (for now) to fix Module Not Found error in Next.js.
It turns out that webpack will "hoist" dynamically imported modules and attempt to resolve them at build time, even though it's an optional peer dep:
Add runs.retrieve management API method to get info about a run by run ID
v3: Usage tracking
Fix for calling trigger and passing a custom queue
Export queue from the SDK
Extract common trigger code into internal functions and add a tasks.batchTriggerAndWait function
v3: Recover from server rate limiting errors in a more reliable way
Rollback to try and fix some dependent attempt issues
Support self-hosters pushing to a custom registry when running deploy
v3: Trigger delayed runs and reschedule them
v3: Export AbortTaskRunError from @trigger.dev/sdk/v3
Added replayRun function to the SDK
Improve the SDK function types and expose a new APIError instead of the APIResult type
You can now add tags to runs and list runs using them
Add configure function to be able to configure the SDK manually
Use global setTimeout to ensure cross-runtime support
Fixed incorrect span timings around checkpoints by implementing a precise wall clock that resets after restores
Adding task with a triggerSource of schedule
Lock SDK and CLI deps on exact core version
Updates the
trigger,batchTriggerand their*AndWaitvariants to use the first parameter for the payload/items, and the second parameter for options.Before:
await yourTask.trigger({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, }); await yourTask.triggerAndWait({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, }); await yourTask.batchTrigger({ items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }], }); await yourTask.batchTriggerAndWait({ items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }], });After:
await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.batchTrigger([ { payload: { foo: "bar" } }, { payload: { foo: "baz" } }, ]); await yourTask.batchTriggerAndWait([ { payload: { foo: "bar" } }, { payload: { foo: "baz" } }, ]);We've also changed the API of the
triggerAndWaitresult. Before, if the subtask that was triggered finished with an error, we would automatically "rethrow" the error in the parent task.Now instead we're returning a
TaskRunResultobject that allows you to discriminate between successful and failed runs in the subtask:Before:
try { const result = await yourTask.triggerAndWait({ foo: "bar" }); // result is the output of your task console.log("result", result); } catch (error) { // handle subtask errors here }After:
const result = await yourTask.triggerAndWait({ foo: "bar" }); if (result.ok) { console.log(`Run ${result.id} succeeded with output`, result.output); } else { console.log(`Run ${result.id} failed with error`, result.error); }When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait)
TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId
A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys
A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view
When resolving batchTriggerAndWait, the runtimes no longer reject promises, leading to an error in the parent task
Move to our global system from AsyncLocalStorage for the current task context storage
Remove unimplemented batchOptions
Add triggerAndWait().unwrap() to more easily get at the output or throw the subtask error
v2: Better handle recovering from platform communication errors by auto-yielding back to the platform in case of temporary API failures
When a v2 run hits the rate limit, reschedule with the reset date
Management SDK overhaul and adding the runs.list API
v3: Adding SDK functions for triggering tasks in a typesafe way, without importing task file
Dynamically import superjson and fix some bundling issues
Added timezone support to schedules
v3: Include presigned urls for downloading large payloads and outputs when using runs.retrieve
Added declarative cron schedules
Added cancelRun to the SDK
Added a new global - Task Catalog - to better handle task metadata
Extracting out all the non-SDK related features from the main @trigger.dev/core/v3 export
Remove msw and retry.interceptFetch
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.