fix: Fix sending pin data twice causing payload too large errors (#9710)

This commit is contained in:
Tomi Turtiainen 2024-06-12 15:11:39 +03:00 committed by GitHub
parent e08b4337c9
commit 6c1a4c8ebf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 22 deletions

View file

@ -536,10 +536,13 @@ describe('Execution', () => {
cy.wait('@workflowRun').then((interception) => { cy.wait('@workflowRun').then((interception) => {
expect(interception.request.body).not.to.have.property('runData').that.is.an('object'); expect(interception.request.body).not.to.have.property('runData').that.is.an('object');
expect(interception.request.body).to.have.property('pinData').that.is.an('object'); expect(interception.request.body).to.have.property('workflowData').that.is.an('object');
expect(interception.request.body.workflowData)
.to.have.property('pinData')
.that.is.an('object');
const expectedPinnedDataKeys = ['Webhook']; const expectedPinnedDataKeys = ['Webhook'];
const { pinData } = interception.request.body as Record<string, object>; const { pinData } = interception.request.body.workflowData as Record<string, object>;
expect(Object.keys(pinData)).to.have.lengthOf(expectedPinnedDataKeys.length); expect(Object.keys(pinData)).to.have.lengthOf(expectedPinnedDataKeys.length);
expect(pinData).to.include.all.keys(expectedPinnedDataKeys); expect(pinData).to.include.all.keys(expectedPinnedDataKeys);
}); });
@ -555,14 +558,18 @@ describe('Execution', () => {
cy.wait('@workflowRun').then((interception) => { cy.wait('@workflowRun').then((interception) => {
expect(interception.request.body).to.have.property('runData').that.is.an('object'); expect(interception.request.body).to.have.property('runData').that.is.an('object');
expect(interception.request.body).to.have.property('pinData').that.is.an('object'); expect(interception.request.body).to.have.property('workflowData').that.is.an('object');
expect(interception.request.body.workflowData)
.to.have.property('pinData')
.that.is.an('object');
const expectedPinnedDataKeys = ['Webhook']; const expectedPinnedDataKeys = ['Webhook'];
const expectedRunDataKeys = ['If', 'Webhook']; const expectedRunDataKeys = ['If', 'Webhook'];
const { pinData, runData } = interception.request.body as Record<string, object>; const { pinData } = interception.request.body.workflowData as Record<string, object>;
expect(Object.keys(pinData)).to.have.lengthOf(expectedPinnedDataKeys.length); expect(Object.keys(pinData)).to.have.lengthOf(expectedPinnedDataKeys.length);
expect(pinData).to.include.all.keys(expectedPinnedDataKeys); expect(pinData).to.include.all.keys(expectedPinnedDataKeys);
const { runData } = interception.request.body as Record<string, object>;
expect(Object.keys(runData)).to.have.lengthOf(expectedRunDataKeys.length); expect(Object.keys(runData)).to.have.lengthOf(expectedRunDataKeys.length);
expect(runData).to.include.all.keys(expectedRunDataKeys); expect(runData).to.include.all.keys(expectedRunDataKeys);
}); });

View file

@ -1,13 +1,6 @@
import type { IWorkflowDb } from '@/Interfaces'; import type { IWorkflowDb } from '@/Interfaces';
import type { AuthenticatedRequest, ListQuery } from '@/requests'; import type { AuthenticatedRequest, ListQuery } from '@/requests';
import type { import type { INode, IConnections, IWorkflowSettings, IRunData, StartNodeData } from 'n8n-workflow';
INode,
IConnections,
IWorkflowSettings,
IRunData,
IPinData,
StartNodeData,
} from 'n8n-workflow';
export declare namespace WorkflowRequest { export declare namespace WorkflowRequest {
type CreateUpdatePayload = Partial<{ type CreateUpdatePayload = Partial<{
@ -26,7 +19,6 @@ export declare namespace WorkflowRequest {
type ManualRunPayload = { type ManualRunPayload = {
workflowData: IWorkflowDb; workflowData: IWorkflowDb;
runData: IRunData; runData: IRunData;
pinData: IPinData;
startNodes?: StartNodeData[]; startNodes?: StartNodeData[];
destinationNode?: string; destinationNode?: string;
}; };

View file

@ -92,16 +92,11 @@ export class WorkflowExecutionService {
} }
async executeManually( async executeManually(
{ { workflowData, runData, startNodes, destinationNode }: WorkflowRequest.ManualRunPayload,
workflowData,
runData,
pinData,
startNodes,
destinationNode,
}: WorkflowRequest.ManualRunPayload,
user: User, user: User,
pushRef?: string, pushRef?: string,
) { ) {
const pinData = workflowData.pinData;
const pinnedTrigger = this.selectPinnedActivatorStarter( const pinnedTrigger = this.selectPinnedActivatorStarter(
workflowData, workflowData,
startNodes?.map((nodeData) => nodeData.name), startNodes?.map((nodeData) => nodeData.name),

View file

@ -200,7 +200,6 @@ export interface IStartRunData {
startNodes?: StartNodeData[]; startNodes?: StartNodeData[];
destinationNode?: string; destinationNode?: string;
runData?: IRunData; runData?: IRunData;
pinData?: IPinData;
} }
export interface ITableData { export interface ITableData {

View file

@ -219,7 +219,6 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
const startRunData: IStartRunData = { const startRunData: IStartRunData = {
workflowData, workflowData,
runData: newRunData, runData: newRunData,
pinData: workflowData.pinData,
startNodes, startNodes,
}; };
if ('destinationNode' in options) { if ('destinationNode' in options) {