From 2f1efa68ad2006415ab9d311f08c84d42ae576cb Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Mon, 15 Sep 2025 17:31:12 +0200 Subject: [PATCH] Fix manual trigger variables + workflow not found in sentry (#14509) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Error in [sentry](https://twenty-v7.sentry.io/issues/6677390012/?environment=prod&environment=prod-eu&project=4507072499810304&query=is%3Aunresolved%20%21issue.type%3A%5Bperformance_consecutive_db_queries%2Cperformance_consecutive_http%2Cperformance_file_io_main_thread%2Cperformance_db_main_thread%2Cperformance_n_plus_one_db_queries%2Cperformance_n_plus_one_api_calls%2Cperformance_p95_endpoint_regression%2Cperformance_slow_db_query%2Cperformance_render_blocking_asset_span%2Cperformance_uncompressed_assets%2Cperformance_http_overhead%2Cperformance_large_http_payload%5D%20timesSeen%3A%3E10&referrer=issue-stream) : due to workflow being deleted, so not found - Error with Manual Trigger variable fixed Before Capture d’écran 2025-09-15 à 16 24
34 After Capture d’écran 2025-09-15 à 16 24
02 --- .../types/guards/isOpenStepOutputSchema.ts | 4 ++-- ...ionOutputSchema.ts => isRecordStepOutputSchema.ts} | 11 ++++++++--- .../utils/searchVariableThroughOutputSchemaV2.ts | 4 ++-- .../jobs/workflow-statuses-update.job.ts | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) rename packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/{isRecordActionOutputSchema.ts => isRecordStepOutputSchema.ts} (69%) diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isOpenStepOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isOpenStepOutputSchema.ts index 7afb0ccd06..f30332449e 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isOpenStepOutputSchema.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isOpenStepOutputSchema.ts @@ -9,14 +9,14 @@ import { isCodeOutputSchema } from './isCodeOutputSchema'; import { isDatabaseEventTriggerOutputSchema } from './isDatabaseEventTriggerOutputSchema'; import { isFindRecordsOutputSchema } from './isFindRecordsOutputSchema'; import { isFormOutputSchema } from './isFormOutputSchema'; -import { isRecordActionOutputSchema } from './isRecordActionOutputSchema'; +import { isRecordStepOutputSchema } from './isRecordStepOutputSchema'; export const isOpenStepOutputSchema = ( stepType: WorkflowActionType | WorkflowTriggerType, schema: OutputSchemaV2, ): schema is OpenStepOutputSchema => { return ( - !isRecordActionOutputSchema(stepType, schema) && + !isRecordStepOutputSchema(stepType, schema) && !isDatabaseEventTriggerOutputSchema(stepType, schema) && !isFindRecordsOutputSchema(stepType, schema) && !isFormOutputSchema(stepType, schema) && diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordActionOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordStepOutputSchema.ts similarity index 69% rename from packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordActionOutputSchema.ts rename to packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordStepOutputSchema.ts index 66aed4af17..31e39b2bb1 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordActionOutputSchema.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/types/guards/isRecordStepOutputSchema.ts @@ -5,11 +5,16 @@ import { import { type RecordActionOutputSchema } from '@/workflow/workflow-variables/types/RecordActionOutputSchema'; import { type OutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2'; -const RECORD_ACTION_TYPES = ['CREATE_RECORD', 'UPDATE_RECORD', 'DELETE_RECORD']; +const RECORD_STEP_TYPES = [ + 'CREATE_RECORD', + 'UPDATE_RECORD', + 'DELETE_RECORD', + 'MANUAL', +]; -export const isRecordActionOutputSchema = ( +export const isRecordStepOutputSchema = ( stepType: WorkflowActionType | WorkflowTriggerType, schema: OutputSchemaV2, ): schema is RecordActionOutputSchema => { - return RECORD_ACTION_TYPES.includes(stepType); + return RECORD_STEP_TYPES.includes(stepType); }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2.ts index 2eca82a301..c20d303dba 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2.ts @@ -6,7 +6,7 @@ import { isCodeOutputSchema } from '@/workflow/workflow-variables/types/guards/i import { isDatabaseEventTriggerOutputSchema } from '@/workflow/workflow-variables/types/guards/isDatabaseEventTriggerOutputSchema'; import { isFindRecordsOutputSchema } from '@/workflow/workflow-variables/types/guards/isFindRecordsOutputSchema'; import { isFormOutputSchema } from '@/workflow/workflow-variables/types/guards/isFormOutputSchema'; -import { isRecordActionOutputSchema } from '@/workflow/workflow-variables/types/guards/isRecordActionOutputSchema'; +import { isRecordStepOutputSchema } from '@/workflow/workflow-variables/types/guards/isRecordStepOutputSchema'; import { type StepOutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2'; import { searchVariableThroughBaseOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughBaseOutputSchema'; @@ -27,7 +27,7 @@ export const searchVariableThroughOutputSchemaV2 = ({ rawVariableName: string; isFullRecord: boolean; }) => { - if (isRecordActionOutputSchema(stepType, stepOutputSchema.outputSchema)) { + if (isRecordStepOutputSchema(stepType, stepOutputSchema.outputSchema)) { return searchVariableThroughRecordOutputSchema({ stepName: stepOutputSchema.name, recordOutputSchema: stepOutputSchema.outputSchema, diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts index 30105a6a1b..07a05a42e1 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts @@ -128,6 +128,7 @@ export class WorkflowStatusesUpdateJob { where: { id: workflowId, }, + withDeleted: true, }); if (isEqual(newWorkflowStatuses, previousWorkflow.statuses)) {