diff --git a/packages/cli/src/events/WorkflowStatistics.ts b/packages/cli/src/events/WorkflowStatistics.ts index 2744e3b268..a4023d261a 100644 --- a/packages/cli/src/events/WorkflowStatistics.ts +++ b/packages/cli/src/events/WorkflowStatistics.ts @@ -24,7 +24,7 @@ export async function workflowExecutionCompleted( // Get the workflow id const workflowId = workflowData.id; - if (workflowId === undefined) return; + if (!workflowId) return; // Try insertion and if it fails due to key conflicts then update the existing entry instead try { @@ -59,7 +59,11 @@ export async function workflowExecutionCompleted( } } -export async function nodeFetchedData(workflowId: string, node: INode): Promise { +export async function nodeFetchedData( + workflowId: string | undefined | null, + node: INode, +): Promise { + if (!workflowId) return; // Try to insert the data loaded statistic try { await Db.collections.WorkflowStatistics.insert({