fix(Google Sheets Node): Fix "Maximum call stack size exceeded" error on too many rows (#7384)

Fixes:

1. https://community.n8n.io/t/google-sheets-error-maximum-call-stack-size-exceeded/31006
2. https://community.n8n.io/t/error-maximum-call-stack-size-exceeded-in-google-sheet-read-rows/20307
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-10-09 16:58:16 +02:00 committed by GitHub
parent c5ee06cc61
commit 732b15a1fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -7,7 +7,7 @@ import { GoogleSheetsV2 } from './v2/GoogleSheetsV2.node';
export class GoogleSheets extends VersionedNodeType {
constructor() {
const baseDescription: INodeTypeBaseDescription = {
displayName: 'Google Sheets ',
displayName: 'Google Sheets',
name: 'googleSheets',
icon: 'file:googleSheets.svg',
group: ['input', 'output'],

View file

@ -6,7 +6,7 @@ import { getSpreadsheetId } from '../helpers/GoogleSheets.utils';
import type { GoogleSheets, ResourceLocator } from '../helpers/GoogleSheets.types';
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const operationResult: INodeExecutionData[] = [];
let operationResult: INodeExecutionData[] = [];
try {
const resource = this.getNodeParameter('resource', 0);
@ -17,6 +17,7 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
operation,
} as GoogleSheets;
let results: INodeExecutionData[] | undefined;
if (googleSheets.resource === 'sheet') {
const { mode, value } = this.getNodeParameter('documentId', 0) as IDataObject;
const spreadsheetId = getSpreadsheetId(mode as ResourceLocator, value as string);
@ -49,16 +50,17 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
sheetName = await googleSheet.spreadsheetGetSheetNameById(sheetId);
}
operationResult.push(
...(await sheet[googleSheets.operation].execute.call(
this,
googleSheet,
sheetName,
sheetId,
)),
results = await sheet[googleSheets.operation].execute.call(
this,
googleSheet,
sheetName,
sheetId,
);
} else if (googleSheets.resource === 'spreadsheet') {
operationResult.push(...(await spreadsheet[googleSheets.operation].execute.call(this)));
results = await spreadsheet[googleSheets.operation].execute.call(this);
}
if (results?.length) {
operationResult = operationResult.concat(results);
}
} catch (err) {
if (this.continueOnFail()) {