Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,15 @@ describe('useRunWorkflow({ router })', () => {
expect(workflowsStore.executionWaitingForWebhook).toBe(false);
});

it('should prevent running a webhook-based workflow that has issues', async () => {
it('should not prevent running a webhook-based workflow that has issues', async () => {
const { runWorkflowApi } = useRunWorkflow({ router });
vi.mocked(workflowsStore).nodesIssuesExist = true;
vi.mocked(workflowsStore).runWorkflow.mockResolvedValue({
executionId: '123',
waitingForWebhook: true,
});

await expect(runWorkflowApi({} as IStartRunData)).rejects.toThrow(
'workflowRun.showError.resolveOutstandingIssues',
);
expect(async () => await runWorkflowApi({} as IStartRunData)).not.toThrow();

vi.mocked(workflowsStore).nodesIssuesExist = false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export function useRunWorkflow(useRunWorkflowOpts: {
workflowState.setActiveExecutionId(response.executionId);
}

if (response.waitingForWebhook === true && workflowsStore.nodesIssuesExist) {
workflowState.setActiveExecutionId(undefined);
throw new Error(i18n.baseText('workflowRun.showError.resolveOutstandingIssues'));
}

if (response.waitingForWebhook === true) {
workflowsStore.executionWaitingForWebhook = true;
}
Expand Down Expand Up @@ -377,6 +372,12 @@ export function useRunWorkflow(useRunWorkflowOpts: {
workflowState.setWorkflowExecutionData(executionData);
nodeHelpers.updateNodesExecutionIssues();

const triggerNodeName = triggerToStartFrom?.name ?? '';
const triggerNode = workflowsStore.getNodeByName(triggerNodeName);
if (triggerNode && workflowsStore.nodeHasIssuesDownstream(triggerNode.name)) {
throw new Error(i18n.baseText('workflowRun.showError.resolveOutstandingIssues'));
}

useDocumentTitle().setDocumentTitle(workflowObject.value.name as string, 'EXECUTING');
const runWorkflowApiResponse = await runWorkflowApi(startRunData);
const pinData = workflowData.pinData ?? {};
Expand Down
Loading
Loading