mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Google Sheets Node): Check for null before destructuring (#7729)
https://n8nio.sentry.io/issues/4613453684
This commit is contained in:
@@ -5,7 +5,12 @@ import { getSpreadsheetId } from '../helpers/GoogleSheets.utils';
|
|||||||
import type { ResourceLocator } from '../helpers/GoogleSheets.types';
|
import type { ResourceLocator } from '../helpers/GoogleSheets.types';
|
||||||
|
|
||||||
export async function getSheets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
export async function getSheets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const { mode, value } = this.getNodeParameter('documentId', 0) as IDataObject;
|
const documentId = this.getNodeParameter('documentId', 0) as IDataObject | null;
|
||||||
|
|
||||||
|
if (!documentId) return [];
|
||||||
|
|
||||||
|
const { mode, value } = documentId;
|
||||||
|
|
||||||
const spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);
|
const spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);
|
||||||
|
|
||||||
const sheet = new GoogleSheet(spreadsheetId, this);
|
const sheet = new GoogleSheet(spreadsheetId, this);
|
||||||
@@ -33,7 +38,12 @@ export async function getSheets(this: ILoadOptionsFunctions): Promise<INodePrope
|
|||||||
export async function getSheetHeaderRow(
|
export async function getSheetHeaderRow(
|
||||||
this: ILoadOptionsFunctions,
|
this: ILoadOptionsFunctions,
|
||||||
): Promise<INodePropertyOptions[]> {
|
): Promise<INodePropertyOptions[]> {
|
||||||
const { mode, value } = this.getNodeParameter('documentId', 0) as IDataObject;
|
const documentId = this.getNodeParameter('documentId', 0) as IDataObject | null;
|
||||||
|
|
||||||
|
if (!documentId) return [];
|
||||||
|
|
||||||
|
const { mode, value } = documentId;
|
||||||
|
|
||||||
const spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);
|
const spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);
|
||||||
|
|
||||||
const sheet = new GoogleSheet(spreadsheetId, this);
|
const sheet = new GoogleSheet(spreadsheetId, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user