Improve logs in workflow trigger (#12215)

- distinguish logs coming from webhook and job triggers
- add workspace and workflow ids to help debugging

Hard to debug sentry issue:

https://twenty-v7.sentry.io/issues/6605607134/?project=4507072499810304&query=&referrer=issue-stream&stream_index=7
This commit is contained in:
Thomas Trompette
2025-05-22 14:56:30 +02:00
committed by GitHub
parent 0f9cdd9d39
commit 4ac47c2a1b
2 changed files with 22 additions and 12 deletions

View File

@ -52,14 +52,14 @@ export class WorkflowTriggerJob {
if (!workflow) {
throw new WorkflowTriggerException(
'Workflow not found',
`Workflow ${data.workflowId} not found in workspace ${data.workspaceId}`,
WorkflowTriggerExceptionCode.NOT_FOUND,
);
}
if (!workflow.lastPublishedVersionId) {
throw new WorkflowTriggerException(
'Workflow has no published version',
`Workflow ${data.workflowId} has no published version in workspace ${data.workspaceId}`,
WorkflowTriggerExceptionCode.INTERNAL_ERROR,
);
}
@ -75,13 +75,13 @@ export class WorkflowTriggerJob {
if (!workflowVersion) {
throw new WorkflowTriggerException(
'Workflow version not found',
`Workflow version ${workflow.lastPublishedVersionId} not found in workspace ${data.workspaceId}`,
WorkflowTriggerExceptionCode.NOT_FOUND,
);
}
if (workflowVersion.status !== WorkflowVersionStatus.ACTIVE) {
throw new WorkflowTriggerException(
'Workflow version is not active',
`Workflow version ${workflowVersion.id} is not active in workspace ${data.workspaceId}`,
WorkflowTriggerExceptionCode.INTERNAL_ERROR,
);
}