From 98e1d21a043bc10c620d5855c770507d91afec40 Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Mon, 16 Dec 2024 09:32:15 -0500 Subject: [PATCH] [lib] Add log and continue in getPushUserInfo when thread missing from ThreadStore Summary: This has come up twice now: [ENG-9454](https://linear.app/comm/issue/ENG-9454/cannot-read-properties-of-undefined-when-leaving-thread) and [ENG-9946](https://linear.app/comm/issue/ENG-9946/cannot-read-properties-of-undefined-reading-members). I think it will help us in the future to have a more specific error message. It also is probably a good idea to `continue;` here, in case there are other notifs that we can send successfully. Test Plan: Ran the code and confirmed the log was printed Reviewers: angelika, kamil, tomek Reviewed By: kamil Differential Revision: https://phab.comm.dev/D14160 --- lib/push/send-utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/push/send-utils.js b/lib/push/send-utils.js index f25d72b651..81cd894ce4 100644 --- a/lib/push/send-utils.js +++ b/lib/push/send-utils.js @@ -166,6 +166,10 @@ async function getPushUserInfo( for (const threadID of threadsToMessageIndices.keys()) { const threadInfo = thickRawThreadInfos[threadID]; + if (!threadInfo) { + console.log(`getPushUserInfo could not find ${threadID} in ThreadStore`); + continue; + } for (const memberInfo of threadInfo.members) { if ( !isMemberActive(memberInfo) ||