Skip to content

Commit

Permalink
fix: Fix sending pin data twice causing payload too large errors (#9710)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi committed Jun 12, 2024
1 parent e08b433 commit 6c1a4c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
15 changes: 11 additions & 4 deletions cypress/e2e/19-execution.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,13 @@ describe('Execution', () => {

cy.wait('@workflowRun').then((interception) => {
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 { 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(pinData).to.include.all.keys(expectedPinnedDataKeys);
});
Expand All @@ -555,14 +558,18 @@ describe('Execution', () => {

cy.wait('@workflowRun').then((interception) => {
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 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(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(runData).to.include.all.keys(expectedRunDataKeys);
});
Expand Down
10 changes: 1 addition & 9 deletions packages/cli/src/workflows/workflow.request.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import type { IWorkflowDb } from '@/Interfaces';
import type { AuthenticatedRequest, ListQuery } from '@/requests';
import type {
INode,
IConnections,
IWorkflowSettings,
IRunData,
IPinData,
StartNodeData,
} from 'n8n-workflow';
import type { INode, IConnections, IWorkflowSettings, IRunData, StartNodeData } from 'n8n-workflow';

export declare namespace WorkflowRequest {
type CreateUpdatePayload = Partial<{
Expand All @@ -26,7 +19,6 @@ export declare namespace WorkflowRequest {
type ManualRunPayload = {
workflowData: IWorkflowDb;
runData: IRunData;
pinData: IPinData;
startNodes?: StartNodeData[];
destinationNode?: string;
};
Expand Down
9 changes: 2 additions & 7 deletions packages/cli/src/workflows/workflowExecution.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,11 @@ export class WorkflowExecutionService {
}

async executeManually(
{
workflowData,
runData,
pinData,
startNodes,
destinationNode,
}: WorkflowRequest.ManualRunPayload,
{ workflowData, runData, startNodes, destinationNode }: WorkflowRequest.ManualRunPayload,
user: User,
pushRef?: string,
) {
const pinData = workflowData.pinData;
const pinnedTrigger = this.selectPinnedActivatorStarter(
workflowData,
startNodes?.map((nodeData) => nodeData.name),
Expand Down
1 change: 0 additions & 1 deletion packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export interface IStartRunData {
startNodes?: StartNodeData[];
destinationNode?: string;
runData?: IRunData;
pinData?: IPinData;
}

export interface ITableData {
Expand Down
1 change: 0 additions & 1 deletion packages/editor-ui/src/composables/useRunWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
const startRunData: IStartRunData = {
workflowData,
runData: newRunData,
pinData: workflowData.pinData,
startNodes,
};
if ('destinationNode' in options) {
Expand Down

0 comments on commit 6c1a4c8

Please sign in to comment.