Skip to content

Bun Setup Guide

CLI uses Node.js

The Trigger.dev CLI does not yet support Bun. Run the CLI using Node.js (npx). Your tasks will execute with Bun.

Supported Bun version: Deployed tasks run on Bun 1.3.3. Use Bun 1.3.x for local development.

Known limitation

Some OpenTelemetry instrumentations won't work with Bun — Bun does not support Node's register hook.

Setup

1. Initialize with Bun Runtime

bash
npx trigger.dev@latest init --runtime bun

This creates trigger.config.ts with runtime: "bun" and a /trigger directory.

2. Example Bun Task

ts
// trigger/example.ts
import { Database } from "bun:sqlite";
import { task } from "@trigger.dev/sdk";

export const bunTask = task({
  id: "bun-task",
  run: async (payload: { query: string }) => {
    const db = new Database(":memory:");
    const query = db.query("select 'Hello world' as message;");
    console.log(query.get()); // { message: "Hello world" }
    return { message: "Query executed" };
  },
});

3. Start Dev Server

bash
# Use npx (Node.js) for CLI, Bun will execute tasks
npx trigger.dev@latest dev

4. Deploy

bash
npx trigger.dev@latest deploy

trigger.config.ts

ts
import { defineConfig } from "@trigger.dev/sdk";

export default defineConfig({
  project: "your-project-ref",
  runtime: "bun",
  dirs: ["./trigger"],
});

Built from official Trigger.dev documentation