mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-23 18:41:48 -08:00
fix(Google Sheets Node): Check for null
before destructuring (#7729)
https://n8nio.sentry.io/issues/4613453684
This commit is contained in:
parent
d39bb2540f
commit
5d4a52d3b7
|
@ -5,7 +5,12 @@ import { getSpreadsheetId } from '../helpers/GoogleSheets.utils';
|
|||
import type { ResourceLocator } from '../helpers/GoogleSheets.types';
|
||||
|
||||
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 sheet = new GoogleSheet(spreadsheetId, this);
|
||||
|
@ -33,7 +38,12 @@ export async function getSheets(this: ILoadOptionsFunctions): Promise<INodePrope
|
|||
export async function getSheetHeaderRow(
|
||||
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 sheet = new GoogleSheet(spreadsheetId, this);
|
||||
|
|
Loading…
Reference in a new issue