mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -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 {
|
export class GoogleSheets extends VersionedNodeType {
|
||||||
constructor() {
|
constructor() {
|
||||||
const baseDescription: INodeTypeBaseDescription = {
|
const baseDescription: INodeTypeBaseDescription = {
|
||||||
displayName: 'Google Sheets ',
|
displayName: 'Google Sheets',
|
||||||
name: 'googleSheets',
|
name: 'googleSheets',
|
||||||
icon: 'file:googleSheets.svg',
|
icon: 'file:googleSheets.svg',
|
||||||
group: ['input', 'output'],
|
group: ['input', 'output'],
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getSpreadsheetId } from '../helpers/GoogleSheets.utils';
|
||||||
import type { GoogleSheets, ResourceLocator } from '../helpers/GoogleSheets.types';
|
import type { GoogleSheets, ResourceLocator } from '../helpers/GoogleSheets.types';
|
||||||
|
|
||||||
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const operationResult: INodeExecutionData[] = [];
|
let operationResult: INodeExecutionData[] = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -17,6 +17,7 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
|
||||||
operation,
|
operation,
|
||||||
} as GoogleSheets;
|
} as GoogleSheets;
|
||||||
|
|
||||||
|
let results: INodeExecutionData[] | undefined;
|
||||||
if (googleSheets.resource === 'sheet') {
|
if (googleSheets.resource === 'sheet') {
|
||||||
const { mode, value } = this.getNodeParameter('documentId', 0) as IDataObject;
|
const { mode, value } = this.getNodeParameter('documentId', 0) as IDataObject;
|
||||||
const spreadsheetId = getSpreadsheetId(mode as ResourceLocator, value as string);
|
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);
|
sheetName = await googleSheet.spreadsheetGetSheetNameById(sheetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
operationResult.push(
|
results = await sheet[googleSheets.operation].execute.call(
|
||||||
...(await sheet[googleSheets.operation].execute.call(
|
this,
|
||||||
this,
|
googleSheet,
|
||||||
googleSheet,
|
sheetName,
|
||||||
sheetName,
|
sheetId,
|
||||||
sheetId,
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
} else if (googleSheets.resource === 'spreadsheet') {
|
} 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) {
|
} catch (err) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
|
|
Loading…
Reference in a new issue