diff --git a/packages/builder/src/stores/builder/automations.js b/packages/builder/src/stores/builder/automations.js index 9c27233c06..b7d55ee2d4 100644 --- a/packages/builder/src/stores/builder/automations.js +++ b/packages/builder/src/stores/builder/automations.js @@ -527,10 +527,21 @@ const automationActions = store => ({ } else if ( currentBlock?.stepId === AutomationActionStepId.EXECUTE_SCRIPT ) { - runtimeName = `steps["${pathSteps[idx]?.id}"].${name}` + const stepId = pathSteps[idx].id + if (!stepId) { + notifications.error("Error generating binding: Step ID not found.") + return null + } + runtimeName = `steps["${stepId}"].${name}` } else { - runtimeName = `steps.${pathSteps[idx]?.id}.${name}` + const stepId = pathSteps[idx].id + if (!stepId) { + notifications.error("Error generating binding: Step ID not found.") + return null + } + runtimeName = `steps.${stepId}.${name}` } + return runtimeName }