The trigger.config.ts file
This file is used to configure your project and how it’s bundled.
Let’s take a look at a basic trigger.config.ts
file. This is generated for you when you follow the quick start guide. This file is used to configure your project and how it’s bundled.
Most of the time you don’t need to change anything in this file, or if you do then we will tell you when you the run the CLI command.
Instrumentations
We use OpenTelemetry (OTEL) for our run logs. This means you get a lot of information about your tasks with no effort. But you probably want to add more information to your logs. For example, here’s all the Prisma calls automatically logged:
Here we add Prisma and OpenAI instrumentations to your trigger.config.ts
file.
ESM-only packages
We’ll let you know when running the CLI dev command if this is a problem. Some packages are ESM-only so they don’t work directly from CJS when using Node.js. In that case you need to add them to the dependenciesToBundle
array in your trigger.config.ts
file.
Prisma (and other generators)
Prisma works by generating a client from your prisma.schema
file. This means you need to do a couple of things to get it to work with Trigger:
package.json postinstall `prisma generate`
Anything you put in postinstall
will be run as part of the install step. This is how Next.js recommends you set up Prisma anyway.
Add prisma and the schema to trigger.config.ts
This tells Trigger to bundle the Prisma client and the schema file.
Troubleshooting
If you have an issue with bundling let us know on Discord or via email.
Was this page helpful?