fix: patch whatsapp-web.js for WA Web 2.3000.1043xxx _serialized rename#9
Open
dafibh wants to merge 2 commits into
Open
fix: patch whatsapp-web.js for WA Web 2.3000.1043xxx _serialized rename#9dafibh wants to merge 2 commits into
dafibh wants to merge 2 commits into
Conversation
WhatsApp Web build 2.3000.1043xxx renamed the internal WID/MsgKey property `_serialized` to `$1`, breaking whatsapp-web.js@1.34.7's injected layer: getChats, getChatById, fetchMessages, downloadMedia and message delete all threw a minified `r` error (HTTP 500). Backport the dual-compat shim from upstream PR wwebjs/whatsapp-web.js#201840 as a local patch applied at Docker build time. Adds widSerialized / normalizeSerialized helpers so node-side code keeps reading `id._serialized`. API response shape is unchanged (adds only a raw `$1` field alongside `_serialized`). The patch is version-guarded in the Dockerfile: it applies only to whatsapp-web.js 1.34.7 and is skipped for any other version, so bumping to an official fix will not break the build. See patches/README.md for revert steps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The send path returned `Msg.get(newMsgKey._serialized)`, which became `undefined` after WA renamed `_serialized` to `$1`, so `client.sendMessage` responded with a null message id. Use widSerialized(newMsgKey) so the sent message resolves and Client.sendMessage's getMessageModel call normalizes it. Verified on prod: send response now returns id._serialized / id.id, and deleting with that id straight from the send response succeeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
WhatsApp Web build
2.3000.1043xxxrenamed the internal WID/MsgKey property_serializedto$1.whatsapp-web.js@1.34.7(latest published) still reads_serialized, so every operation going through the injected layer —getChats,getChatById,fetchMessages,downloadMedia, and message delete — throws a minifiedrerror and returns HTTP 500.Confirmed on prod: all sessions CONNECTED on live WA
2.3000.1043xxx, butgetChatsand delete returned{"success":false,"error":"r"}.Fix
Backports the dual-compat shim from upstream PR wwebjs/whatsapp-web.js#201840 (unmerged) as a local patch applied at Docker build time. No dependency on the fork branch;
package.jsonkeeps^1.34.7.patches/whatsapp-web.js+1.34.7.patch— addswidSerialized/normalizeSerializedhelpers inInjected/Utils.js, applied ingetMessageModel/getChatModelandMessagefrom/to/author.Dockerfiledeps stage applies the patch with GNUpatch(installed only in the throwawaydepsstage).API contract
Unchanged. Responses keep every original field (
id._serialized,remote,id,fromMe,from,to, ...). Only additive change: a raw$1field alongside_serialized(same value).Revertability
whatsapp-web.jsis exactly1.34.7; any other version is skipped with a log line, so bumping to an official fix won't break the build.git revertthis commit. Full steps inpatches/README.md.Verification (prod, non-destructive)
getChatserror:"r"getChatByIderror:"r"fetchMessages_getMessageById(delete's lookup, viagetClassInfo)error:"r"id._serializedpopulated🤖 Generated with Claude Code