fix(core): Restore run data value when offloading to workers (#14516)

This commit is contained in:
Iván Ovejero 2025-04-10 11:13:53 +02:00 committed by GitHub
parent b7a1d63410
commit 313cfec74d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 1 deletions

View File

@ -411,5 +411,45 @@ describe('WorkflowExecutionService', () => {
expect(node).toEqual(webhookNode);
});
describe('offloading manual executions to workers', () => {
test('when receiving no `runData`, should set `runData` to undefined in `executionData`', async () => {
const originalEnv = process.env;
process.env.OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS = 'true';
const configMock = { getEnv: jest.fn() };
configMock.getEnv.mockReturnValue('queue');
const workflowRunnerMock = mock<WorkflowRunner>();
workflowRunnerMock.run.mockResolvedValue('fake-execution-id');
const service = new WorkflowExecutionService(
mock(),
mock(),
mock(),
mock(),
nodeTypes,
mock(),
workflowRunnerMock,
mock(),
mock(),
mock(),
);
await service.executeManually(
{
workflowData: mock<IWorkflowBase>({ nodes: [] }),
startNodes: [],
runData: undefined,
},
mock<User>({ id: 'user-id' }),
);
const callArgs = workflowRunnerMock.run.mock.calls[0][0];
expect(callArgs.executionData?.resultData?.runData).toBeUndefined();
process.env = originalEnv;
});
});
});
});

View File

@ -208,7 +208,8 @@ export class WorkflowExecutionService {
},
resultData: {
pinData,
runData: runData ?? {},
// @ts-expect-error CAT-752
runData,
},
manualData: {
userId: data.userId,