From 4d058b70539cbad62ff83fdc0aeb9911c4e0a39e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 31 Jul 2024 11:11:52 +0100 Subject: [PATCH] Fixing an issue seen when browsing through datadog error logs for app service. --- packages/server/src/sdk/app/rows/search/sqs.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index 018b2ae4a3..5da2a7bcfb 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -72,10 +72,14 @@ function buildInternalFieldList( } if (isRelationship) { const linkCol = col as RelationshipFieldMetadata - const relatedTable = tables.find(table => table._id === linkCol.tableId)! + const relatedTable = tables.find(table => table._id === linkCol.tableId) // no relationships provided, don't go more than a layer deep - fieldList = fieldList.concat(buildInternalFieldList(relatedTable, tables)) - addJunctionFields(relatedTable, ["doc1.fieldName", "doc2.fieldName"]) + if (relatedTable) { + fieldList = fieldList.concat( + buildInternalFieldList(relatedTable, tables) + ) + addJunctionFields(relatedTable, ["doc1.fieldName", "doc2.fieldName"]) + } } else { fieldList.push(`${table._id}.${mapToUserColumn(col.name)}`) }