Hi folks, I’m trying to load my Trigger.dev tasks from two different apps in my monorepo.
The path ./core/jobs/trigger is relative to the app where my trigger.config.ts file is located (/apps/web). The second path ../api/src/trigger points to another app in the monorepo, which also contains tasks that I want to reuse.
I know the best approach here would probably be to create a separate package just for the tasks, but that’s not possible at the moment. The problem is that, even though I’m exporting tasks inside ../api/src/trigger, Trigger.dev throws the following error:
Error: No tasks exported from your trigger files
Here’s my config:
export default defineConfig({
enableConsoleLogging: true,
project: "<ref>",
logLevel: "log",
maxDuration,
retries: {
enabledInDev: true,
default: {
maxAttempts: 3,
minTimeoutInMs: 1000,
maxTimeoutInMs: 10000,
factor: 2,
},
},
dirs: ["./core/jobs/trigger", "../api/src/trigger"], // the api path reference another app in my monorepo
instrumentations: [new OpenAIInstrumentation()],
build: {
external: ["jsdom"],
extensions: [
additionalFiles({ files: ["data/countries.json"] }),
syncVercelEnvVars(),
prismaExtension({
schema: "../../packages/db/prisma/schema.prisma",
clientGenerator: "client",
version: "6.13.0",
}),
],
},
});
And here’s one of my tasks inside the api app:
export const createMeterEventTask = schemaTask({...});
Has anyone faced this before? Is there a way to make Trigger.dev recognize tasks from another app in the monorepo, or is the only solution really to move them into a shared package?