diff --git a/packages/@n8n/task-runner/src/__tests__/task-runner-sentry.test.ts b/packages/@n8n/task-runner/src/__tests__/task-runner-sentry.test.ts index 1a3779cc1f..272d84bae7 100644 --- a/packages/@n8n/task-runner/src/__tests__/task-runner-sentry.test.ts +++ b/packages/@n8n/task-runner/src/__tests__/task-runner-sentry.test.ts @@ -136,6 +136,7 @@ describe('TaskRunnerSentry', () => { environment: 'local', serverName: 'test', serverType: 'task_runner', + withEventLoopBlockDetection: false, }); }); }); diff --git a/packages/@n8n/task-runner/src/task-runner-sentry.ts b/packages/@n8n/task-runner/src/task-runner-sentry.ts index 58bc9ded7e..1bf9808f9c 100644 --- a/packages/@n8n/task-runner/src/task-runner-sentry.ts +++ b/packages/@n8n/task-runner/src/task-runner-sentry.ts @@ -26,6 +26,7 @@ export class TaskRunnerSentry { environment, serverName: deploymentName, beforeSendFilter: this.filterOutUserCodeErrors, + withEventLoopBlockDetection: false, }); } diff --git a/packages/cli/src/commands/base-command.ts b/packages/cli/src/commands/base-command.ts index 525c833171..0b52098eeb 100644 --- a/packages/cli/src/commands/base-command.ts +++ b/packages/cli/src/commands/base-command.ts @@ -90,6 +90,7 @@ export abstract class BaseCommand { release: `n8n@${N8N_VERSION}`, serverName: deploymentName, releaseDate: N8N_RELEASE_DATE, + withEventLoopBlockDetection: true, }); process.once('SIGTERM', this.onTerminationSignal('SIGTERM')); diff --git a/packages/core/src/errors/error-reporter.ts b/packages/core/src/errors/error-reporter.ts index 40a6f8b5ae..ccbcd05582 100644 --- a/packages/core/src/errors/error-reporter.ts +++ b/packages/core/src/errors/error-reporter.ts @@ -15,6 +15,10 @@ type ErrorReporterInitOptions = { environment: string; serverName: string; releaseDate?: Date; + + /** Whether to enable event loop block detection, if Sentry is enabled. */ + withEventLoopBlockDetection: boolean; + /** * Function to allow filtering out errors before they are sent to Sentry. * Return true if the error should be filtered out. @@ -83,6 +87,7 @@ export class ErrorReporter { environment, serverName, releaseDate, + withEventLoopBlockDetection, }: ErrorReporterInitOptions) { if (inTest) return; @@ -126,7 +131,9 @@ export class ErrorReporter { 'ContextLines', ]; - const eventLoopBlockIntegration = await this.getEventLoopBlockIntegration(); + const eventLoopBlockIntegration = withEventLoopBlockDetection + ? await this.getEventLoopBlockIntegration() + : []; init({ dsn,