diff --git a/services/workflows-service/src/webhooks/webhooks.service.ts b/services/workflows-service/src/webhooks/webhooks.service.ts index 6a73840926..a72600f504 100644 --- a/services/workflows-service/src/webhooks/webhooks.service.ts +++ b/services/workflows-service/src/webhooks/webhooks.service.ts @@ -25,6 +25,8 @@ export class WebhooksService { endUserId: string; data: IndividualAmlWebhookInput['data']; }) { + this.logger.log('Started handling individual AML hit', { endUserId }); + const { projectId, ...rest } = await this.endUserRepository.findByIdUnscoped(endUserId, { select: { approvalState: true, @@ -85,10 +87,12 @@ export class WebhooksService { }); if (hits.length === 0) { + this.logger.log('No AML hits found', { endUserId }); + return; } - await this.workflowService.createOrUpdateWorkflowRuntime({ + const workflow = await this.workflowService.createOrUpdateWorkflowRuntime({ workflowDefinitionId, context: { aml: data, @@ -105,5 +109,7 @@ export class WebhooksService { projectIds: [projectId], currentProjectId: projectId, }); + + this.logger.log(`Created workflow for AML hits`, { workflow }); } } diff --git a/services/workflows-service/src/workflow/workflow.service.ts b/services/workflows-service/src/workflow/workflow.service.ts index 8116b06911..75f6846e23 100644 --- a/services/workflows-service/src/workflow/workflow.service.ts +++ b/services/workflows-service/src/workflow/workflow.service.ts @@ -1352,6 +1352,11 @@ export class WorkflowService { const result = ConfigSchema.safeParse(config); if (!result.success) { + this.logger.error('Invalid workflow config', { + config, + error: result.error, + }); + throw ValidationError.fromZodError(result.error); }