GuidesUpdated

How do I run a Trigger.dev worker beside my app in Canopy?

Set up Trigger.dev once, save its dev command next to your website and API in Canopy, run a dashboard test and debug the right process.

On this page

A background task can fail while the website looks fine. Run the Trigger.dev dev worker as a saved service beside your app and API in Canopy. Then you and your coding agent can see which part failed.

Canopy Servers view for starting and inspecting local project commands
Canopy Servers view for starting and inspecting local project commands

Finish Trigger.dev's first-run setup in a terminal

You need an existing project and a Trigger.dev account or self-hosted instance. The quick start's `init` command installs SDK packages, creates `trigger.config.ts` and an example task, and connects a project, prompting for login, project and updates. Run it once in a regular Canopy terminal. It changes project files, so don't rerun it daily.

Save the three development commands

Add the frontend and API as Canopy components if they live in separate directories. In the Servers panel, save the app and API commands your project already uses. For Trigger.dev, set the working directory to the repository root or the package with `trigger.config.ts`, not the task folder.

Save your project's dev-worker script, or `pnpm dlx trigger.dev@latest dev` if that fits your package manager. `dev` runs a local task server and may prompt for package updates, so a project script with reviewed versions is more predictable. Canopy starts the commands; Trigger.dev stays the task platform.

Start everything, then check each layer

Start the API, website and Trigger.dev command, then check the frontend URL, an API response and the worker output separately. The CLI prints when it's listening and links the dashboard. In the Development environment, run the example task from its Test page and check the run page and worker output. A running process means a command started; a successful test run means the worker works.

Give the agent a precise failure

If a browser action produces no task run, name the boundary that failed: UI request, backend trigger call, registration or execution. Include the time, environment, run ID if any, first error and expected result. Ask the agent to inspect that component and report the commands it ran. The Trigger.dev dashboard is the authority on run state and traces.

Keep keys and deployment separate

Your backend needs a Development environment key to trigger tasks. Keep it in your approved local secret location, out of commits, screenshots and handoffs. `--env-file` only sets variables for the CLI process, not tasks; use Trigger.dev's task-environment settings for those. The Canopy service is for local development, not production.

Resume from what's actually running

When you reopen the project, see which processes are alive and start the rest. Check the worker output, the Development environment and the branch before resuming an agent. Nothing ran while your computer was off. Rerun the dashboard test after dependency or config changes.

Copyable resources

Three-component setup card

Use your repository's own scripts; finish Trigger.dev login and init first.

Project root: [repository path]
Frontend component: [path] | command: [frontend dev script] | expected URL: [ ]
API component: [path] | command: [API dev script] | expected health check: [ ]
Trigger.dev component: [project root or task package] | command: [existing script or pnpm dlx trigger.dev@latest dev]
Development environment: [Trigger.dev project and environment name]
Check: frontend loads; API responds; worker says listening; dashboard example task completes; run ID/link: [ ]
On return: check running processes and branch, then restart only what's missing.

Frequently asked questions

Does Canopy include a special Trigger.dev integration?

No. This uses Canopy's saved local commands. Trigger.dev's CLI runs the dev worker, and its dashboard shows task runs.

Can I run the Trigger.dev command with one click every day?

Yes, once login, project setup and update prompts are handled, save the dev command in Canopy's Servers panel. Check its output each time; saved doesn't mean running.

Why is my task missing a variable even though I passed --env-file?

Trigger.dev documents `--env-file` as setting variables for the CLI process, not task processes. Set task variables through Trigger.dev's environment settings and keep secrets out of the repository.

More questions and answers →

Sources and further reading