From d4da343a8f120aed431b8c8684a5d0259bebf970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Lis=C3=A9?= Date: Thu, 10 Oct 2024 14:03:23 -0700 Subject: [PATCH] NOBUG: Skip indexing user information into opensearch. --- handlers/dynamoStream/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/handlers/dynamoStream/index.js b/handlers/dynamoStream/index.js index 691bd9e..feb3e90 100644 --- a/handlers/dynamoStream/index.js +++ b/handlers/dynamoStream/index.js @@ -1,5 +1,5 @@ const { logger } = require('/opt/base'); -const { batchWriteData, AUDIT_TABLE_NAME, marshall, unmarshall } = require('/opt/dynamodb'); +const { batchWriteData, AUDIT_TABLE_NAME, marshall, unmarshall, USER_ID_PARTITION } = require('/opt/dynamodb'); const { OPENSEARCH_MAIN_INDEX, bulkWriteDocuments } = require('/opt/opensearch'); @@ -20,6 +20,12 @@ exports.handler = async function (event, context) { const creationTime = createDate.toISOString(); const gsipk = record.dynamodb.Keys.pk; + + // If pk === 'userid' then skip + if (gsipk.S === USER_ID_PARTITION) { + continue; + } + const gsisk = record.dynamodb.Keys.sk; const user = newImage?.lastModifiedBy?.S || "system";