This file is used to configure your project and how it’s built.
trigger.config.ts
file is used to configure your Trigger.dev project. It is a TypeScript file at the root of your project that exports a default configuration object. Here’s an example:
dirs
option.build
config is automatically stripped out of the config file, and
imports used inside build config with be tree-shaken out.dirs
option:
dirs
option, we will automatically detect directories that are named trigger
in your project, but we recommend specifying the directories explicitly. The dirs
option is an array of strings, so you can specify multiple directories if you have tasks in multiple locations.
We will search for TypeScript and JavaScript files in the specified directories and include them in the build process. We automatically exclude files that have .test
or .spec
in the name, but you can customize this by specifying glob patterns in the ignorePatterns
option:
onStart
, onSuccess
and onFailure
:
trigger.config.ts
file.
Package | Description |
---|---|
@opentelemetry/instrumentation-http | Logs all HTTP calls |
@prisma/instrumentation | Logs all Prisma calls, you need to enable tracing |
@traceloop/instrumentation-openai | Logs all OpenAI calls |
@opentelemetry/instrumentation-fs
which logs all file system calls is currently not supported.trigger.config.ts
file:
AXIOM_API_TOKEN
and AXIOM_DATASET
environment variables in your project.
logExporters
option is available in the v4 beta SDK. See our v4 upgrade
guide for more information.OTEL_*
environment variables, as they would conflict with our internal telemetry. Instead you should configure the exporters via passing in arguments to the OTLPTraceExporter
and OTLPLogExporter
constructors. For example, here is how you can configure exporting to Honeycomb:
node
runtime, but you can try our experimental bun
runtime by setting the runtime
option in your config file:
21.7.3
21.7.3
logLevel
only determines which logs are sent to the Trigger.dev instance when using the logger
API. All console
based logs are always sent.
maxDuration
for all tasks in your project:
build
option:
trigger.config.ts
file is included in the bundle, but with the build
configuration
stripped out. These means any imports only used inside the build
configuration are also removed
from the final bundle.external
option:
node_modules
directory.
Each entry in the external should be a package name, not necessarily the import path. For example, if you want to exclude the ai
package, but you are importing ai/rsc
, you should just include ai
in the external
array:
re2
, sharp
, and sqlite3
should be added to external.jsx
options that are passed to esbuild
using the jsx
option:
React
in your JSX files. You can disable this by setting automatic
to false
.
See the esbuild JSX documentation for more information.
conditions
option:
react-server
condition will resolve ai/rsc
to the server version of the ai/rsc
export.
Custom conditions will also be passed to the node
runtime when running your tasks.
@trigger.dev/build
package into your devDependencies
, or you can create your own.
additionalPackages
emitDecoratorMetadata