Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logs to AML webhook #2372

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion services/workflows-service/src/webhooks/webhooks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -105,5 +109,7 @@ export class WebhooksService {
projectIds: [projectId],
currentProjectId: projectId,
});

this.logger.log(`Created workflow for AML hits`, { workflow });
}
}
5 changes: 5 additions & 0 deletions services/workflows-service/src/workflow/workflow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

tomer-shvadron marked this conversation as resolved.
Show resolved Hide resolved
throw ValidationError.fromZodError(result.error);
}

Expand Down
Loading