Packages

@trigger.dev/sdk

4.8.8 · 20 Nov 2026MIT1.7M / weekRepositoryHomepagenpmAtom feed

Your version

4.0.0

major18 Aug 2025Where it was published

4.8.8 is the newest release of 4.x.

In short

1 breaking3 removed1 deprecated8 new7 fixed8 changed1 internal

  • Breaking

    Trigger.dev v4 release. Please see our upgrade to v4 docs to view the full changelog: trigger.dev/docs/upgrade-to-v4

  • Removed

    Removed deprecated properties from ctx

  • Removed

    Concurrency is never released when a run is first blocked via a waitpoint, at either the env or queue level.

  • Removed

    Concurrency is always released when a run is checkpointed and shutdown, at both the env and queue level.

  • Deprecated

    Deprecate toolTask and replace with ai.tool(mySchemaTask)

Release note

Major Changes

Patch Changes

External trace correlation and propagation

We will now correlate your external traces with trigger.dev traces and logs when using our external exporters:

```ts
import { defineConfig } from "@trigger.dev/sdk";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

export default defineConfig({
  project: process.env.TRIGGER_PROJECT_REF,
  dirs: ["./src/trigger"],
  telemetry: {
    logExporters: [
      new OTLPLogExporter({
        url: "https://api.axiom.co/v1/logs",
        headers: {
          Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
          "X-Axiom-Dataset": "test",
        },
      }),
    ],
    exporters: [
      new OTLPTraceExporter({
        url: "https://api.axiom.co/v1/traces",
        headers: {
          Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
          "X-Axiom-Dataset": "test",
        },
      }),
    ],
  },
  maxDuration: 3600,
});
```

You can also now propagate your external trace context when calling back into your own backend infra from inside a trigger.dev task:

```ts
import { otel, task } from "@trigger.dev/sdk";
import { context, propagation } from "@opentelemetry/api";

async function callNextjsApp() {
  return await otel.withExternalTrace(async () => {
    const headersObject = {};

    // Now context.active() refers to your external trace context
    propagation.inject(context.active(), headersObject);

    const result = await fetch("http://localhost:3000/api/demo-call-from-trigger", {
      headers: new Headers(headersObject),
      method: "POST",
      body: JSON.stringify({
        message: "Hello from Trigger.dev",
      }),
    });

    return result.json();
  });
}

export const myTask = task({
  id: "my-task",
  run: async (payload: any) => {
    await callNextjsApp();
  },
});
```
  • Add jsonSchema support when indexing tasks

  • Fixed an issue with realtime streams that timeout and resume streaming dropping chunks

  • Added and cleaned up the run ctx param:

    • New optional properties ctx.run.parentTaskRunId and ctx.run.rootTaskRunId reference the current run's root/parent ID.

    • Removed deprecated properties from ctx

    • Added a new ctx.deployment object that contains information about the deployment associated with the run.

    We also update metadata.root and metadata.parent to work even when the run is a "root" run (meaning it doesn't have a parent or a root associated run). This now works:

    metadata.root.set("foo", "bar");
    metadata.parent.set("baz", 1);
    metadata.current().foo; // "bar"
    metadata.current().baz; // 1
  • The envvars.list() and retrieve() functions receive isSecret for each value. Secret values are always redacted.

  • Fix issue where realtime streams would cut off after 5 minutes

  • Deprecated

    Deprecate toolTask and replace with ai.tool(mySchemaTask)

  • Display clickable links in Cursor terminal

  • Removed

    Removes the releaseConcurrencyOnWaitpoint option on queues and the releaseConcurrency option on various wait functions. Replaced with the following default behavior:

    • Concurrency is never released when a run is first blocked via a waitpoint, at either the env or queue level.

    • Concurrency is always released when a run is checkpointed and shutdown, at both the env and queue level.

    Additionally, environment concurrency limits now have a new "Burst Factor", defaulting to 2.0x. The "Burst Factor" allows the environment-wide concurrency limit to be higher than any individual queue's concurrency limit. For example, if you have an environment concurrency limit of 100, and a Burst Factor of 2.0x, then you can execute up to 200 runs concurrently, but any one task/queue can still only execute 100 runs concurrently.

    We've done some work cleaning up the run statuses. The new statuses are:

    • PENDING_VERSION: Task is waiting for a version update because it cannot execute without additional information (task, queue, etc.)

    • QUEUED: Task is waiting to be executed by a worker

    • DEQUEUED: Task has been dequeued and is being sent to a worker to start executing.

    • EXECUTING: Task is currently being executed by a worker

    • WAITING: Task has been paused by the system, and will be resumed by the system

    • COMPLETED: Task has been completed successfully

    • CANCELED: Task has been canceled by the user

    • FAILED: Task has failed to complete, due to an error in the system

    • CRASHED: Task has crashed and won't be retried, most likely the worker ran out of resources, e.g. memory or storage

    • SYSTEM_FAILURE: Task has failed to complete, due to an error in the system

    • DELAYED: Task has been scheduled to run at a specific time

    • EXPIRED: Task has expired and won't be executed

    • TIMED_OUT: Task has reached it's maxDuration and has been stopped

    We've removed the following statuses:

    • WAITING_FOR_DEPLOY: This is no longer used, and is replaced by PENDING_VERSION

    • FROZEN: This is no longer used, and is replaced by WAITING

    • INTERRUPTED: This is no longer used

    • REATTEMPTING: This is no longer used, and is replaced by EXECUTING

    We've also added "boolean" helpers to runs returned via the API and from Realtime:

    • isQueued: Returns true when the status is QUEUED, PENDING_VERSION, or DELAYED

    • isExecuting: Returns true when the status is EXECUTING, DEQUEUED. These count against your concurrency limits.

    • isWaiting: Returns true when the status is WAITING. These do not count against your concurrency limits.

    • isCompleted: Returns true when the status is any of the completed statuses.

    • isCanceled: Returns true when the status is CANCELED

    • isFailed: Returns true when the status is any of the failed statuses.

    • isSuccess: Returns true when the status is COMPLETED

    This change adds the ability to easily detect which runs are being counted against your concurrency limit by filtering for both EXECUTING or DEQUEUED.

  • Add onCancel lifecycle hook

  • Provide realtime skipColumns option via untamperable public access tokens

  • Removed triggerAndPoll. It was never recommended so it's been removed.

  • Improve metadata flushing efficiency by collapsing operations

  • Upgrade to zod 3.25.76

  • Specify a region override when triggering a run

  • Added runs.list filtering for queue and machine

  • Maintain proper context in metadata.root and parent getters

  • v4: New lifecycle hooks

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.