Changelog #54
New package release: @v3.0.0-beta.15
CTO, Trigger.dev
Today we're releasing packages v3.0.0-beta.15
with some breaking changes, fixes, and API improvements.
Breaking changes
v3.0.0-beta.15
updates the Task.trigger
, Task.batchTrigger
and their *AndWait
variants to use the first parameter for the payload/items, and the second parameter for options.
Before:
_15await yourTask.trigger({_15 payload: { foo: "bar" },_15 options: { idempotencyKey: "key_1234" },_15});_15await yourTask.triggerAndWait({_15 payload: { foo: "bar" },_15 options: { idempotencyKey: "key_1234" },_15});_15_15await yourTask.batchTrigger({_15 items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }],_15});_15await yourTask.batchTriggerAndWait({_15 items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }],_15});
After:
_11await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" });_11await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" });_11_11await yourTask.batchTrigger([_11 { payload: { foo: "bar" } },_11 { payload: { foo: "baz" } },_11]);_11await yourTask.batchTriggerAndWait([_11 { payload: { foo: "bar" } },_11 { payload: { foo: "baz" } },_11]);
We've also changed the API of the triggerAndWait
result. 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 TaskRunResult
object that allows you to discriminate between successful and failed runs in the subtask:
Before:
_10try {_10 const result = await yourTask.triggerAndWait({ foo: "bar" });_10_10 // result is the output of your task_10 console.log("result", result);_10} catch (error) {_10 // handle subtask errors here_10}
After:
_10const result = await yourTask.triggerAndWait({ foo: "bar" });_10_10if (result.ok) {_10 console.log(`Run ${result.id} succeeded with output`, result.output);_10} else {_10 console.log(`Run ${result.id} failed with error`, result.error);_10}
Fixes
- Fixes an issue when using idempotency keys with
triggerAndWait
andbatchTriggerAndWait
failing to resume if the idempotency key matched an already completed run. - Add additional logging around cleaning up dev workers, and always kill them after 5 seconds if they haven't already exited
- Fixes an issue that caused failed tasks when resuming after calling
triggerAndWait
orbatchTriggerAndWait
in prod/staging (this doesn't effect dev).
The version of Node.js we use for deployed workers (latest 20) would crash with an out-of-memory error when the checkpoint was restored. This crash does not happen on Node 18x or Node21x, so we've decided to upgrade the worker version to Node.js21x, to mitigate this issue.
You'll need to re-deploy to production to fix the issue.
Improvements
- We no longer limit individual task concurrency when no concurrency limit is set for the task or the queue the task belongs to. The concurrency limit will fall back to the org/env concurrency limit instead.
Upgrade now
To upgrade to v3.0.0-beta.15
, run:
_10npm install @trigger-dev/[email protected]
or
_10yarn add @trigger-dev/[email protected]
or
_10pnpm add @trigger-dev/[email protected]