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.onStart
, onSuccess
and onFailure
:
trigger.config.ts
file.
Package | Description |
---|---|
@opentelemetry/instrumentation-undici | Logs all fetch calls (inc. Undici fetch) |
@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.node
runtime, but you can try our experimental bun
runtime by setting the runtime
option in your config file:
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.
additionalFiles
build extension and use it in your trigger.config.ts
file:
files
array to the build directory. The files
array can contain globs. The output paths will match the path of the file, relative to the root of the project.
additionalPackages
additionalPackages
build extension and use it in your trigger.config.ts
file:
exec
. We will try to automatically resolve the version of the package but you can specify the version by using the @
symbol:
emitDecoratorMetadata
emitDecoratorMetadata
typescript compiler option, import the emitDecoratorMetadata
build extension and use it in your trigger.config.ts
file:
emitDecoratorMetadata
enabled in your tsconfig.json
file, as well as typescript
installed in
your devDependencies
.dev
command, only when running the deploy
command.migrate
option:
generator
statements defined in your schema file, you can pass in the clientGenerator
option to specify the prisma-client-js
generator, which will prevent other generators from being generated:
typedSql
option:
prismaExtension
will inject the DATABASE_URL
environment variable into the build process. Learn more about setting environment variables for deploying in our Environment Variables guide.These environment variables are only used during the build process and are not embedded in the final container image.syncEnvVars
build extension replaces the deprecated resolveEnvVars
export. Check out our syncEnvVars documentation for more information.
syncVercelEnvVars
build extension syncs environment variables from your Vercel project to Trigger.dev.
VERCEL_ACCESS_TOKEN
and VERCEL_PROJECT_ID
environment variables, or pass
in the token and project ID as arguments to the syncVercelEnvVars
build extension. If you’re
working with a team project, you’ll also need to set VERCEL_TEAM_ID
, which can be found in your
team settings. You can find / generate the VERCEL_ACCESS_TOKEN
in your Vercel
dashboard. Make sure the scope of the token covers
the project with the environment variables you want to sync.trigger.config.ts
file:
ffmpeg
build extension to your build process:
ffmpeg
that is available in the Debian package manager. If you need a specific version, you can pass in the version as an argument:
FFMPEG_PATH
and FFPROBE_PATH
to your environment variables, making it easy to use popular ffmpeg libraries like fluent-ffmpeg
.
Follow this example to get setup with Trigger.dev and FFmpeg in your project.
esbuildPlugin
extension:
aptGet
extension:
name
and zero or more lifecycle hooks (onBuildStart
and onBuildComplete
) that allow you to modify the BuildContext
object that is passed to the build process through adding layers. For example, this is how the aptGet
extension is implemented:
trigger.config.ts
file:
@trigger.dev/build
package for inspiration, which you can see in our repo here