fix(engine): restore sending on Jul 2026 WhatsApp Web ($1 id rename) — temporary whatsapp-web.js fork pin#1
Open
dallascyclist wants to merge 1 commit into
Conversation
…via temporary whatsapp-web.js fork pin WhatsApp Web's mid-July 2026 update renamed the message-id field `id._serialized` -> `id.$1`, which breaks whatsapp-web.js 1.34.7 (the latest stable, Apr 2026): `client.sendMessage()` returns undefined and presence/`getChatById` throw a minified `r: r`. Net effect: ALL outbound sending fails while receiving still works — the adapter then throws "Cannot read properties of undefined (reading 'id')" on `msg.id._serialized` in sendTextMessage. TEMPORARY FIX — pin whatsapp-web.js to the community fork commit that shims `$1` -> `_serialized`: lindionez/whatsapp-web.js @ f4ea1e3 (PR wwebjs/whatsapp-web.js#201832). No patched official release exists yet (2.0.0-alpha.0 on npm is a dead 2023 tag). Verified in prod: self-send returns HTTP 201 and the message records status=sent with a real waMessageId (was: failed / null). Also surface `error.stack` in the plugin logger (it was collapsing thrown errors to `.message`, which is why the real error only ever showed as the opaque "r"), and add chatId/author/errorType to the translation hook error log. That instrumentation is what surfaced the root cause. REVERT PLAN: once wwebjs/whatsapp-web.js ships a fixed release, set `"whatsapp-web.js": "^1.34.x"` (or the fixed version) and re-run `npm install` to regenerate the lock, then rebuild. The `.stack` logging change is a keeper — leave it in. Refs: wwebjs/whatsapp-web.js#201836, #201838, #201849 Claude-Session: https://claude.ai/code/session_01HeKGtw8knz2S8vumAT7BhT
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.
What & why
WhatsApp Web's mid-July 2026 update renamed the message-id field
id._serialized→id.$1. This breaks whatsapp-web.js 1.34.7 (the latest stable, Apr 2026):client.sendMessage()returnsundefinedgetChatByIdthrow a minifiedr: rDownstream, our adapter throws
TypeError: Cannot read properties of undefined (reading 'id')onmsg.id._serializedinsendTextMessage. On the prod translation bot this took the feature fully down (translations stopped posting) after a routine session reconnect on 2026-07-19.Widely reported upstream: wwebjs/whatsapp-web.js#201836, #201838, #201849.
The dependency is pinned to a community fork commit, not an official release:
whatsapp-web.js→https://codeload.github.com/lindionez/whatsapp-web.js/tar.gz/f4ea1e3cf4076e44e36dfe5f81ea57048d2f7761lindionez/whatsapp-web.js @ f4ea1e3, the head of PR fix(client): add fallback for WhatsApp id._serialized renamed to id.$1 wwebjs/whatsapp-web.js#201832 (feat/fix-_serialized-id-fallback), which adds a$1 → _serializedshim (Base._normalizeId()+ fallbacks across Structures / Util.js / Client.js).2.0.0-alpha.0is a dead 2023 tag; 1.34.7 is the newest stable).Trade-offs to be aware of:
🔁 Revert plan (do this once upstream ships a real fix)
$1fix."whatsapp-web.js": "^1.34.x"(or the fixed version) inpackage.json.npm installto regenerate the lock → rebuild → redeploy → re-run the self-send check.error.stacklogging change below — it's unrelated to this incident.Also included (keepers, independent of the fork)
error.stackin the plugin logger (plugin-loader.service.ts). It was collapsing thrown errors to.message, which is exactly why the real error only ever showed as the opaque"r". This is what made the root cause visible.chatId/author/errorTypeto the translation hook's error log for attribution.Verification
Built and deployed to prod. Post-patch self-send:
Not in this PR (deployment-side)
The deployment also gained a
plugin-initcompose sidecar that re-enables the translation extension plugin ondocker compose up(extension plugins register disabled and don't persist enabled-state). It lives in the gitignored, deployment-localdocker-compose.override.yml, so it's intentionally excluded here.https://claude.ai/code/session_01HeKGtw8knz2S8vumAT7BhT