mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-21 01:47:36 +03:00
fix(core): Prevent node param resolution from failing telemetry graph generation (#9257)
This commit is contained in:
parent
96f02bd655
commit
f6c9493355
@ -126,14 +126,20 @@ export function generateNodesGraph(
|
||||
return;
|
||||
}
|
||||
|
||||
const nodeParameters =
|
||||
getNodeParameters(
|
||||
stickyType.description.properties,
|
||||
stickyNote.parameters,
|
||||
true,
|
||||
false,
|
||||
stickyNote,
|
||||
) ?? {};
|
||||
let nodeParameters: IDataObject = {};
|
||||
|
||||
try {
|
||||
nodeParameters =
|
||||
getNodeParameters(
|
||||
stickyType.description.properties,
|
||||
stickyNote.parameters,
|
||||
true,
|
||||
false,
|
||||
stickyNote,
|
||||
) ?? {};
|
||||
} catch {
|
||||
// prevent node param resolution from failing graph generation
|
||||
}
|
||||
|
||||
const height: number = typeof nodeParameters.height === 'number' ? nodeParameters.height : 0;
|
||||
const width: number = typeof nodeParameters.width === 'number' ? nodeParameters.width : 0;
|
||||
|
@ -5,8 +5,10 @@ import {
|
||||
getDomainBase,
|
||||
getDomainPath,
|
||||
} from '@/TelemetryHelpers';
|
||||
import type { IWorkflowBase } from '@/index';
|
||||
import { ApplicationError, STICKY_NODE_TYPE, type IWorkflowBase } from '@/index';
|
||||
import { nodeTypes } from './ExpressionExtensions/Helpers';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import * as nodeHelpers from '@/NodeHelpers';
|
||||
|
||||
describe('getDomainBase should return protocol plus domain', () => {
|
||||
test('in valid URLs', () => {
|
||||
@ -763,6 +765,16 @@ describe('generateNodesGraph', () => {
|
||||
webhookNodeNames: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('should not fail on error to resolve a node parameter for sticky node type', () => {
|
||||
const workflow = mock<IWorkflowBase>({ nodes: [{ type: STICKY_NODE_TYPE }] });
|
||||
|
||||
jest.spyOn(nodeHelpers, 'getNodeParameters').mockImplementationOnce(() => {
|
||||
throw new ApplicationError('Could not find property option');
|
||||
});
|
||||
|
||||
expect(() => generateNodesGraph(workflow, nodeTypes)).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
function validUrls(idMaker: typeof alphanumericId | typeof email, char = CHAR) {
|
||||
|
Loading…
Reference in New Issue
Block a user