Skip to content

Commit 5a5da47

Browse files
Added logs to AML webhook (#2372)
* feat: added logs to AML webhook * feat: added log when starting aml webhook --------- Co-authored-by: Alon Peretz <[email protected]>
1 parent 1aa075b commit 5a5da47

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

services/workflows-service/src/webhooks/webhooks.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export class WebhooksService {
2525
endUserId: string;
2626
data: IndividualAmlWebhookInput['data'];
2727
}) {
28+
this.logger.log('Started handling individual AML hit', { endUserId });
29+
2830
const { projectId, ...rest } = await this.endUserRepository.findByIdUnscoped(endUserId, {
2931
select: {
3032
approvalState: true,
@@ -85,10 +87,12 @@ export class WebhooksService {
8587
});
8688

8789
if (hits.length === 0) {
90+
this.logger.log('No AML hits found', { endUserId });
91+
8892
return;
8993
}
9094

91-
await this.workflowService.createOrUpdateWorkflowRuntime({
95+
const workflow = await this.workflowService.createOrUpdateWorkflowRuntime({
9296
workflowDefinitionId,
9397
context: {
9498
aml: data,
@@ -105,5 +109,7 @@ export class WebhooksService {
105109
projectIds: [projectId],
106110
currentProjectId: projectId,
107111
});
112+
113+
this.logger.log(`Created workflow for AML hits`, { workflow });
108114
}
109115
}

services/workflows-service/src/workflow/workflow.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,11 @@ export class WorkflowService {
13521352
const result = ConfigSchema.safeParse(config);
13531353

13541354
if (!result.success) {
1355+
this.logger.error('Invalid workflow config', {
1356+
config,
1357+
error: result.error,
1358+
});
1359+
13551360
throw ValidationError.fromZodError(result.error);
13561361
}
13571362

0 commit comments

Comments
 (0)