Skip to content

fix: update package.json to allow puppeteer scripts and add handling … - #201891

Open
nurdiansyahagung10 wants to merge 1 commit into
wwebjs:mainfrom
nurdiansyahagung10:fix-utils-injected-error
Open

fix: update package.json to allow puppeteer scripts and add handling …#201891
nurdiansyahagung10 wants to merge 1 commit into
wwebjs:mainfrom
nurdiansyahagung10:fix-utils-injected-error

Conversation

@nurdiansyahagung10

@nurdiansyahagung10 nurdiansyahagung10 commented Aug 9, 2026

Copy link
Copy Markdown

Serialize message key for WhatsApp LID

Description

Update message serialization logic to properly handle WhatsApp identifiers that may be returned as LID instead of the previously used @g.us or serialized message ID format.

Previously, chat.lastReceivedKey._serialized was used directly when retrieving the last message from WAWebCollections.Msg. This can fail when WhatsApp returns lastReceivedKey in a different format, such as a string or LID-based identifier.

This change normalizes chat.lastReceivedKey before attempting to retrieve the message by:

  • Using the value directly when lastReceivedKey is already a string.
  • Using _serialized when available.
  • Falling back to toString() when necessary.
  • Reusing the normalized key for both Msg.get() and getMessagesById().

This allows the message serialization flow to handle both the existing WhatsApp ID format and the newer LID format more reliably.

Related Issue(s)

Fix message retrieval when WhatsApp returns LID-based identifiers instead of the expected serialized ID format.

Testing Summary

Test Details

Tested message retrieval with different chat.lastReceivedKey formats, including:

  • Serialized WhatsApp message IDs.
  • String-based identifiers.
  • LID-based identifiers.

Verified that model.lastMessage is correctly populated when the corresponding message exists in the message store.

Environment

  • Machine OS: Windows
  • Phone OS: —
  • Library Version: —
  • WhatsApp Web Version: —
  • Browser Type and Version: —
  • Node Version: —

Type of Change

  • Dependency change (package changes such as removals, upgrades, or additions)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-code change (documentation, README, etc.)

Checklist

  • My code follows the style guidelines of this project.
  • All new and existing tests pass (npm test).
  • Typings (e.g. index.d.ts) have been updated if necessary.
  • Usage examples (e.g. example.js) / documentation have been updated if applicable.

@github-actions github-actions Bot added dependencies Dependency updates api changes API modifications utility Utility code labels Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changes API modifications dependencies Dependency updates utility Utility code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant