diff --git a/packages/cli/src/commands/worker.ts b/packages/cli/src/commands/worker.ts index c60b7b4301..5545378f66 100644 --- a/packages/cli/src/commands/worker.ts +++ b/packages/cli/src/commands/worker.ts @@ -29,6 +29,7 @@ import type { WorkerJobStatusSummary } from '@/services/orchestration/worker/typ import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error'; import { BaseCommand } from './BaseCommand'; import { MaxStalledCountError } from '@/errors/max-stalled-count.error'; +import { AuditEventRelay } from '@/eventbus/audit-event-relay.service'; export class Worker extends BaseCommand { static description = '\nStarts a n8n worker'; @@ -287,6 +288,7 @@ export class Worker extends BaseCommand { await Container.get(MessageEventBus).initialize({ workerId: this.queueModeId, }); + Container.get(AuditEventRelay).init(); } /** diff --git a/packages/cli/test/integration/commands/worker.cmd.test.ts b/packages/cli/test/integration/commands/worker.cmd.test.ts index d3483098fe..0ffad7bc05 100644 --- a/packages/cli/test/integration/commands/worker.cmd.test.ts +++ b/packages/cli/test/integration/commands/worker.cmd.test.ts @@ -15,6 +15,7 @@ import { type JobQueue, Queue } from '@/Queue'; import { setupTestCommand } from '@test-integration/utils/testCommand'; import { mockInstance } from '../../shared/mocking'; +import { AuditEventRelay } from '@/eventbus/audit-event-relay.service'; config.set('executions.mode', 'queue'); config.set('binaryDataManager.availableModes', 'filesystem'); @@ -25,6 +26,7 @@ const externalHooks = mockInstance(ExternalHooks); const externalSecretsManager = mockInstance(ExternalSecretsManager); const license = mockInstance(License); const messageEventBus = mockInstance(MessageEventBus); +const auditEventRelay = mockInstance(AuditEventRelay); const orchestrationHandlerWorkerService = mockInstance(OrchestrationHandlerWorkerService); const queue = mockInstance(Queue); const orchestrationWorkerService = mockInstance(OrchestrationWorkerService); @@ -43,6 +45,7 @@ test('worker initializes all its components', async () => { expect(externalHooks.init).toHaveBeenCalledTimes(1); expect(externalSecretsManager.init).toHaveBeenCalledTimes(1); expect(messageEventBus.initialize).toHaveBeenCalledTimes(1); + expect(auditEventRelay.init).toHaveBeenCalledTimes(1); expect(queue.init).toHaveBeenCalledTimes(1); expect(queue.process).toHaveBeenCalledTimes(1); expect(orchestrationWorkerService.init).toHaveBeenCalledTimes(1);