New package release: @v3.0.0-beta.15

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:


_15
await yourTask.trigger({
_15
payload: { foo: "bar" },
_15
options: { idempotencyKey: "key_1234" },
_15
});
_15
await yourTask.triggerAndWait({
_15
payload: { foo: "bar" },
_15
options: { idempotencyKey: "key_1234" },
_15
});
_15
_15
await yourTask.batchTrigger({
_15
items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }],
_15
});
_15
await yourTask.batchTriggerAndWait({
_15
items: [{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }],
_15
});

After:


_11
await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" });
_11
await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" });
_11
_11
await yourTask.batchTrigger([
_11
{ payload: { foo: "bar" } },
_11
{ payload: { foo: "baz" } },
_11
]);
_11
await 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:


_10
try {
_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:


_10
const result = await yourTask.triggerAndWait({ foo: "bar" });
_10
_10
if (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 and batchTriggerAndWait 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 or batchTriggerAndWait 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:


_10
npm install @trigger-dev/[email protected]

or


_10
yarn add @trigger-dev/[email protected]

or


_10
pnpm add @trigger-dev/[email protected]