-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathtrigger.config.ts
More file actions
45 lines (43 loc) · 1.47 KB
/
trigger.config.ts
File metadata and controls
45 lines (43 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import * as Sentry from "@sentry/nextjs"
import { defineConfig } from "@trigger.dev/sdk/v3"
/**
* Trigger.dev configuration for background jobs and scheduled tasks.
* See https://trigger.dev/docs for documentation.
*/
export default defineConfig({
project: process.env.TRIGGER_PROJECT_REF!,
runtime: "node",
logLevel: "log",
// Maximum duration for all tasks (5 minutes)
// See https://trigger.dev/docs/runs/max-duration
maxDuration: 300,
retries: {
enabledInDev: true,
default: {
maxAttempts: 1,
minTimeoutInMs: 1_000,
maxTimeoutInMs: 30_000,
factor: 2,
randomize: true,
},
},
// Task definitions file
dirs: ["./src/data-layer"],
// Initialize Sentry for error tracking in Trigger.dev tasks
// Uses the same Sentry configuration as the Next.js app
// Note: Trigger.dev already initializes OpenTelemetry, so we skip Sentry's OpenTelemetry setup
init: async () => {
const environment = process.env.NEXT_PUBLIC_CONTEXT || "development"
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 0.01,
debug: environment === "development",
environment,
enabled: environment === "production",
initialScope: { tags: { module: "data-layer" } },
// Skip OpenTelemetry setup since Trigger.dev already initializes it
// This prevents "Attempted duplicate registration of API" errors
skipOpenTelemetrySetup: true,
} as Parameters<typeof Sentry.init>[0])
},
})