Skip to content

fix: WhatsApp id._serialized -> id.$1 rename + @lid getChatById#143

Merged
Eonus merged 1 commit into
main-rebasedfrom
fix/wa-serialized-id-lid-fallback
Jul 15, 2026
Merged

fix: WhatsApp id._serialized -> id.$1 rename + @lid getChatById#143
Eonus merged 1 commit into
main-rebasedfrom
fix/wa-serialized-id-lid-fallback

Conversation

@Eonus

@Eonus Eonus commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

WhatsApp Web's July 2026 update renamed the serialized message/chat ID property from id._serialized to id.$1. Every code path reading _serialized now gets undefined, cascading into opaque minified TypeErrors (r: r, r) across the event pipeline — media download, reactions, poll votes, quoted messages, and sendMessage returning empty.

Fixes the two breakages we hit (mirrors of upstream wwebjs/whatsapp-web.js):

Changes

1. _serialized -> $1 fallback (fixes downloadMedia / crash cascade)
Faithful adoption of upstream PR wwebjs/whatsapp-web.js#201832 — applied clean, no conflicts:

  • Add Base._normalizeId() and apply it to every structure _patch() (Message, Chat, Contact, Channel, Broadcast, GroupNotification, GroupChat, ClientInfo)
  • _serialized || $1 fallbacks in Client.js (reactions, poll votes, blocklist, getContactLidAndPhone, customer notes) and Injected/Utils.js (getMessageModel id normalize, newMsgKey, lastReceivedKey, rejectCall, membership requests)

2. @lid getChatById (fixes "No LID for user") — not in upstream PR, added here
In getChat, resolve @lid ids to the phone-number wid via WAWebApiContact.getPhoneNumber() (the accessor getContactLidAndPhone already uses, confirmed working in the issue) before Chat.get/findOrCreateLatestChat, so toUserLidOrThrow no longer fails and the usync fallback isn't fed a lid number as a phone number.

Verification

  • All 11 changed JS files pass node --check.
  • Part 1 is byte-faithful to a PR already running in production on the lindionez/elblogbruno forks.
  • ⚠️ Not runtime-verified against a live WhatsApp session in this branch. Part 2 (the @lid guard) should be smoke-tested against a real @lid chat before relying on it.

🤖 Generated with Claude Code

WhatsApp Web's July 2026 update renamed the serialized message/chat ID
property from `id._serialized` to `id.$1`. Any code reading `_serialized`
got `undefined`, cascading into opaque minified TypeErrors ("r: r") across
the event pipeline: media download, reactions, polls, quoted messages, and
sendMessage returning empty.

- Adopt upstream PR wwebjs#201832: add Base._normalizeId()
  and `_serialized || $1` fallbacks across structures, Client.js and
  Injected/Utils.js. Fixes downloadMedia() "r: r" (issue wwebjs#201833).
- getChat(): resolve @lid ids to the phone-number wid via
  WAWebApiContact.getPhoneNumber() before Chat.get/findOrCreateLatestChat,
  so @lid chats no longer fail with "No LID for user" (issue wwebjs#201834).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Eonus
Eonus merged commit bc58cc2 into main-rebased Jul 15, 2026
0 of 4 checks passed
grupokittel-bit added a commit to grupokittel-bit/whatsapp-web.js that referenced this pull request Jul 25, 2026
… quebrava downloadMedia()/getChats() (erro minificado 'r: r' em toda midia recebida desde 14/07). Base._normalizeId backfilla _serialized a partir de $1 nos construtores (Message/Chat/Contact/Channel/Broadcast/ClientInfo/GroupNotification) + fallback _serialized||$1 nos reads page-side (Client.js, Injected/Utils.js). Porte manual do PR Eonus21#143 (validado pela comunidade na 1.34.7) pra nossa base 1.34.5-alpha.3; 2 hunks N/A (blocos inexistentes na base). node --check OK nos 11 arquivos.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant