forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtrigger.config.ts
More file actions
53 lines (51 loc) · 1.67 KB
/
trigger.config.ts
File metadata and controls
53 lines (51 loc) · 1.67 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
46
47
48
49
50
51
52
53
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_ID || "",
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: 1000,
maxTimeoutInMs: 10000,
factor: 2,
randomize: true,
},
},
// Directory containing Trigger.dev task definitions
dirs: ["./src/data-layer/trigger/tasks"],
// 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",
// 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])
},
// Automatically capture and report task failures to Sentry
onFailure: async ({ payload, error, ctx }) => {
Sentry.captureException(error, {
extra: {
payload,
ctx,
},
})
},
})