From 4ab7257c2b8fe8cf83d898029e94e5d9183e1c66 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 23 Dec 2021 18:02:32 +0100 Subject: [PATCH] :bug: Fix issue with comments in last line --- packages/nodes-base/nodes/Function/Function.node.ts | 2 +- packages/nodes-base/nodes/FunctionItem/FunctionItem.node.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Function/Function.node.ts b/packages/nodes-base/nodes/Function/Function.node.ts index 7abcb6b64e..6c9be76f90 100644 --- a/packages/nodes-base/nodes/Function/Function.node.ts +++ b/packages/nodes-base/nodes/Function/Function.node.ts @@ -102,7 +102,7 @@ return items;`, try { // Execute the function code - items = (await vm.run(`module.exports = async function() {${functionCode}}()`, __dirname)); + items = (await vm.run(`module.exports = async function() {${functionCode}\n}()`, __dirname)); // Do very basic validation of the data if (items === undefined) { throw new NodeOperationError(this.getNode(), 'No data got returned. Always return an Array of items!'); diff --git a/packages/nodes-base/nodes/FunctionItem/FunctionItem.node.ts b/packages/nodes-base/nodes/FunctionItem/FunctionItem.node.ts index c0effffd66..5c173fd8d6 100644 --- a/packages/nodes-base/nodes/FunctionItem/FunctionItem.node.ts +++ b/packages/nodes-base/nodes/FunctionItem/FunctionItem.node.ts @@ -114,7 +114,7 @@ return item;`, let jsonData: IDataObject; try { // Execute the function code - jsonData = await vm.run(`module.exports = async function() {${functionCode}}()`, __dirname); + jsonData = await vm.run(`module.exports = async function() {${functionCode}\n}()`, __dirname); } catch (error) { if (this.continueOnFail()) { returnData.push({json:{ error: error.message }});