Skip to content

Commit f6c9493

Browse files
authored
fix(core): Prevent node param resolution from failing telemetry graph generation (#9257)
1 parent 96f02bd commit f6c9493

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

packages/workflow/src/TelemetryHelpers.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,20 @@ export function generateNodesGraph(
126126
return;
127127
}
128128

129-
const nodeParameters =
130-
getNodeParameters(
131-
stickyType.description.properties,
132-
stickyNote.parameters,
133-
true,
134-
false,
135-
stickyNote,
136-
) ?? {};
129+
let nodeParameters: IDataObject = {};
130+
131+
try {
132+
nodeParameters =
133+
getNodeParameters(
134+
stickyType.description.properties,
135+
stickyNote.parameters,
136+
true,
137+
false,
138+
stickyNote,
139+
) ?? {};
140+
} catch {
141+
// prevent node param resolution from failing graph generation
142+
}
137143

138144
const height: number = typeof nodeParameters.height === 'number' ? nodeParameters.height : 0;
139145
const width: number = typeof nodeParameters.width === 'number' ? nodeParameters.width : 0;

packages/workflow/test/TelemetryHelpers.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
getDomainBase,
66
getDomainPath,
77
} from '@/TelemetryHelpers';
8-
import type { IWorkflowBase } from '@/index';
8+
import { ApplicationError, STICKY_NODE_TYPE, type IWorkflowBase } from '@/index';
99
import { nodeTypes } from './ExpressionExtensions/Helpers';
10+
import { mock } from 'jest-mock-extended';
11+
import * as nodeHelpers from '@/NodeHelpers';
1012

1113
describe('getDomainBase should return protocol plus domain', () => {
1214
test('in valid URLs', () => {
@@ -763,6 +765,16 @@ describe('generateNodesGraph', () => {
763765
webhookNodeNames: [],
764766
});
765767
});
768+
769+
test('should not fail on error to resolve a node parameter for sticky node type', () => {
770+
const workflow = mock<IWorkflowBase>({ nodes: [{ type: STICKY_NODE_TYPE }] });
771+
772+
jest.spyOn(nodeHelpers, 'getNodeParameters').mockImplementationOnce(() => {
773+
throw new ApplicationError('Could not find property option');
774+
});
775+
776+
expect(() => generateNodesGraph(workflow, nodeTypes)).not.toThrow();
777+
});
766778
});
767779

768780
function validUrls(idMaker: typeof alphanumericId | typeof email, char = CHAR) {

0 commit comments

Comments
 (0)