fix: harden session error handling, normalizer null guard, extract redis-connection

- Wrap groupFetchAllParticipating in try/catch to prevent unhandled rejection on connect
- Catch errors from async onMessage/onGroups callbacks via Promise.resolve().catch
- Return null from normalizer when key.id is missing (prevents empty upsert key collision)
- Extract parseRedisUrl to redis-connection.ts to eliminate duplication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 16:18:56 +05:30
parent 213e496c3a
commit 31f047492a
6 changed files with 27 additions and 15 deletions
+4 -1
View File
@@ -35,10 +35,13 @@ export function normalizeMessage(msg: proto.IWebMessageInfo): NormalizedMessage
if (!msg.message) return null;
const platformMsgId = key.id;
if (!platformMsgId) return null;
const content = extractText(msg);
return {
platformMsgId: key.id ?? '',
platformMsgId,
sourceGroupJid: remoteJid,
senderJid: key.participant ?? '',
senderName: msg.pushName ?? undefined,