fix(Google Sheets Node): Fix exception when no Values to Send are set

This commit is contained in:
Michael Kret 2023-01-04 15:54:24 +02:00 committed by GitHub
parent 9615253155
commit f1184ccab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View file

@ -253,9 +253,14 @@ export async function execute(
} else { } else {
const valueToMatchOn = this.getNodeParameter('valueToMatchOn', i) as string; const valueToMatchOn = this.getNodeParameter('valueToMatchOn', i) as string;
const fields = ( const valuesToSend = this.getNodeParameter('fieldsUi.values', i, []) as IDataObject[];
(this.getNodeParameter('fieldsUi.values', i, {}) as IDataObject[]) || [] if (!valuesToSend?.length) {
).reduce((acc, entry) => { throw new NodeOperationError(
this.getNode(),
"At least one value has to be added under 'Values to Send'",
);
}
const fields = valuesToSend.reduce((acc, entry) => {
if (entry.column === 'newColumn') { if (entry.column === 'newColumn') {
const columnName = entry.columnName as string; const columnName = entry.columnName as string;

View file

@ -251,9 +251,14 @@ export async function execute(
} else { } else {
const valueToMatchOn = this.getNodeParameter('valueToMatchOn', i) as string; const valueToMatchOn = this.getNodeParameter('valueToMatchOn', i) as string;
const fields = ( const valuesToSend = this.getNodeParameter('fieldsUi.values', i, []) as IDataObject[];
(this.getNodeParameter('fieldsUi.values', i, {}) as IDataObject[]) || [] if (!valuesToSend?.length) {
).reduce((acc, entry) => { throw new NodeOperationError(
this.getNode(),
"At least one value has to be added under 'Values to Send'",
);
}
const fields = valuesToSend.reduce((acc, entry) => {
if (entry.column === 'newColumn') { if (entry.column === 'newColumn') {
const columnName = entry.columnName as string; const columnName = entry.columnName as string;