Skip to content

fix: patch whatsapp-web.js for WA Web 2.3000.1043xxx _serialized rename#9

Open
dafibh wants to merge 2 commits into
featfrom
fix/wa-web-1043-serialized-compat
Open

fix: patch whatsapp-web.js for WA Web 2.3000.1043xxx _serialized rename#9
dafibh wants to merge 2 commits into
featfrom
fix/wa-web-1043-serialized-compat

Conversation

@dafibh

@dafibh dafibh commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Problem

WhatsApp Web build 2.3000.1043xxx renamed the internal WID/MsgKey property _serialized to $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 minified r error and returns HTTP 500.

Confirmed on prod: all sessions CONNECTED on live WA 2.3000.1043xxx, but getChats and 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.json keeps ^1.34.7.

  • patches/whatsapp-web.js+1.34.7.patch — adds widSerialized / normalizeSerialized helpers in Injected/Utils.js, applied in getMessageModel/getChatModel and Message from/to/author.
  • Dockerfile deps stage applies the patch with GNU patch (installed only in the throwaway deps stage).

API contract

Unchanged. Responses keep every original field (id._serialized, remote, id, fromMe, from, to, ...). Only additive change: a raw $1 field alongside _serialized (same value).

Revertability

  • Version-guarded: the Dockerfile applies the patch only when whatsapp-web.js is exactly 1.34.7; any other version is skipped with a log line, so bumping to an official fix won't break the build.
  • Clean revert: git revert this commit. Full steps in patches/README.md.

Verification (prod, non-destructive)

Step Before After
getChats error:"r" 285 / 520 / 5 chats
getChatById error:"r" resolves
fetchMessages blocked returns message
_getMessageById (delete's lookup, via getClassInfo) error:"r" resolved, id._serialized populated

🤖 Generated with Claude Code

dafibh and others added 2 commits July 17, 2026 01:00
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>
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