fix: dual-compat for WA Web 2.3000.1043xxx ($1 vs _serialized, downloadMedia) - #201840
Open
erickmourasilva wants to merge 2 commits into
Open
erickmourasilva wants to merge 2 commits into
erickmourasilva wants to merge 2 commits into
Conversation
Keep `_serialized` working for older WhatsApp Web clients and accept `$1` on newer builds. Normalize models returned to Node, dual-read LID/PN and message ids, and fall back to DownloadManager when the in-memory media blob looks incomplete/thumbnail-sized. Co-authored-by: Cursor <cursoragent@cursor.com>
JuancaArg
approved these changes
Jul 15, 2026
|
just heads up that _serialized to $1 rename is causing also msg.react() and msg.reply to fail silently. Adding react and reply fallback in Message.js fixes the issue. These fixes works for me in async react(reaction) in async reply() |
Lewson
added a commit
to Lewson/whatsapp-web.js
that referenced
this pull request
Jul 18, 2026
…0.1043xxx) Adapted from wwebjs upstream PR wwebjs#201840. Fixes media download failing with opaque 'r: r' error after WhatsApp Web renamed id._serialized to $1 and started returning thumbnails from mediaBlob.forceToBlob() in version 2.3000.1043xxx (Jul-2026). - Utils.js resolveMediaBlob: null-safe cache lookup + forceToBlob guard, plus fallback via WAWebDownloadManager.downloadAndMaybeDecrypt when the blob cache is empty or looks like a thumbnail. - Message.js downloadMedia / downloadMediaStream: extract msgId with `this.id._serialized ?? this.id.$1` before passing to evaluate.
3 tasks
3 tasks
5 tasks
Contributor
|
Marking this pull request as stale due to inactivity. Push changes or comment to keep it open. It will be closed in 7 days otherwise. Thank you for your contributions. |
9 tasks
3 tasks
soltialabs
pushed a commit
to gperdomosoltia/mensajeria-masiva
that referenced
this pull request
Sep 9, 2026
…ed vs $1) The retry from the previous commit didn't help: logs showed every single voice-note download failing all 3 attempts, while text messages in the same window replied fine - not a transient navigation race. Root cause: WhatsApp Web >= 2.3000.1043xxx exposes message ids as `$1` instead of `_serialized` for @lid senders (WhatsApp's rollout of ids that hide the real phone number - visible in our logs as "...@lid"). whatsapp-web.js's Message.downloadMedia() still reads only `_serialized`, so it passes `undefined` into the page, `Msg.get(undefined)` blows up inside WhatsApp Web's minified bundle, and it surfaces here as the cryptic "r: r" error. Confirmed against upstream issue wwebjs/whatsapp-web.js#201856 (open) - identical stack trace reported by another user - with a fix in wwebjs/whatsapp-web.js#201840, which is unmerged and not in any published npm release yet. Added helper/downloadMediaCompat.js: a reimplementation of downloadMedia() identical to upstream except it resolves the message id as `this.id._serialized ?? this.id.$1`. Patching node_modules directly wasn't viable - this Dockerfile runs `npm install` before `COPY . .`, so a patch-package patch wouldn't exist yet when postinstall runs. Kept the retryAsync wrapper around it as cheap defense-in-depth for an actual navigation race, though it should no longer be needed for this specific bug. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
See wwebjs#201922 Co-authored-by: Cursor <cursoragent@cursor.com>
Eonus
added a commit
to Eonus21/whatsapp-web.js
that referenced
this pull request
Sep 24, 2026
fix(wa-2.3000): concurrent-inject guard + dual-compat serialized ids (wwebjs#201893 + wwebjs#201840)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
widSerialized()/normalizeSerialized()so WID/MsgKey work with both_serialized(legacy) and$1(WA Web 2.3000.1043xxx+).getMessageModelandgetChatModel(fixesgetChatById/ typing crashes withr: r).getContactLidAndPhoneand Message_patchfrom/to/author.downloadMedia/downloadMediaStream.resolveMediaBlob, fall back toDownloadManager.downloadAndMaybeDecryptwhen the in-memory blob is missing or looks thumbnail-sized vsmsg.size.Compatibility
_serialized.$1and mirrors onto_serializedfor node-side consumers.Test plan
msg.getChat()/ typing indicator does not throwdownloadMedia()returns full media (bytes ≈msg.size, not thumbnail)getContactLidAndPhonestill returns lid/pn stringsCloses #201831
Made with Cursor