Skip to content

fix(wa-2.3000): concurrent-inject guard + dual-compat serialized ids (#201893 + #201840) - #147

Merged
Eonus merged 1 commit into
main-rebasedfrom
fix/wa-2.3000-hardening
Sep 24, 2026
Merged

Eonus merged 1 commit into
main-rebasedfrom
fix/wa-2.3000-hardening

Conversation

@Eonus

@Eonus Eonus commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

What

Cherry-pick + reconcile two upstream open PRs that fix the WhatsApp Web 2.3000.x breakage (WA renamed MsgKey/WID _serialized → $1 and moved to @lid ids), reconciled against our fork's existing LID/_serialized work.

Included

  • pedroslopez#201893 — prevent concurrent injection crash. Serializes inject() per Client via _injectQueue, splits inject()/_inject(), routes framenavigated through _handleFrameNavigated and emits inject_error instead of an unhandled rejection, and treats the duplicate Puppeteer binding error as idempotent in exposeFunctionIfAbsent.
    → Fixes the Failed to add page binding with name onLogoutEvent: window['onLogoutEvent'] already exists! crashes seen in prod logs.
  • pedroslopez#201840 — dual-compat for WA Web 2.3000.1043xxx. Adds widSerialized() / normalizeSerialized() helpers, wires them into getMessageModel/getChatModel, uses a dual message id for downloadMedia/downloadMediaStream, and adds a resolveMediaBlob DownloadManager fallback for missing/thumbnail blobs.

Reconciliation notes

  • Kept our rebuildKeySerialized logic and Message.from/to/author || $1 fallbacks (functionally equal to the PR's ?? $1).
  • Kept our delete message.__x_id media fix (already our main-rebased tip).
  • Adopted widSerialized() at getMessageModel/createWid call sites and the try/catch fault-isolation around the getChatModel lastMessage lookup.

Verification

  • node --check passes on all four changed files.
  • ⚠️ Static only — not yet runtime-tested against a live WhatsApp session. Needs a canary account before fleet rollout.

Not included (follow-up)

🤖 Generated with Claude Code

Cherry-pick + reconcile two upstream open PRs for WA Web 2.3000.x breakage:

- wwebjs#201893 (fix/concurrent-inject-race): serialize inject() per Client via
  _injectQueue, split inject()/_inject(), route framenavigated through
  _handleFrameNavigated with inject_error emit, and treat the duplicate
  Puppeteer binding error as idempotent in exposeFunctionIfAbsent.
  Fixes the 'onLogoutEvent already exists' unhandled rejection.

- wwebjs#201840 (fix/wa-web-1043-serialized-compat): add widSerialized()/
  normalizeSerialized() helpers, wire into getMessageModel/getChatModel,
  dual message id for downloadMedia/downloadMediaStream, and
  resolveMediaBlob DownloadManager fallback for missing/thumbnail blobs.

Reconciled against our existing LID/_serialized work (rebuildKeySerialized,
Message from/to/author $1 fallbacks, __x_id drop kept as ours; adopted
widSerialized + try/catch fault isolation in getChatModel lastMessage).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Eonus
Eonus merged commit e2529e3 into main-rebased Sep 24, 2026
0 of 4 checks passed
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