mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
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:
parent
c5ee06cc61
commit
732b15a1fa
|
@ -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'],
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue