fromMe audio from @lid contacts stored as message:null and never dispatched (2.4.0-rc2 / Baileys 7.0.0-rc.9)
Version
- Evolution API: 2.4.0-rc2 (image
evoapicloud/evolution-api:2.4.0-rc2) - Baileys: 7.0.0-rc.9 (shipped with 2.4.0-rc2)
- Integration: Baileys (not Business API)
Summary
When the connected device sends an audio message from itself (fromMe: true) to a contact whose JID is @lid (multi-device / new LID addressing), Evolution stores message: null in the Message table and never dispatches the messages.upsert webhook. Inbound audio works fine. Outbound audio (fromMe) to @s.whatsapp.net contacts also works fine. The bug is specific to fromMe + @lid + audio carrying secretEncryptedMessage / messageContextInfo.
This is the underlying decryption failure behind several user reports — distinct from the remoteJid cosmetic issue tracked in #1872 (which is about JID format), and adjacent to #2550 (getBase64FromMediaMessage failing on iOS audio).
Expected behavior
messages.upsert event fires with the decrypted audioMessage payload, same as for any other outbound audio.
Actual behavior
- The phone sends the audio (delivered fine on WhatsApp).
- Postgres row is created in
Messagewith:key.fromMe = truekey.remoteJidending in@lidmessage = null
- No
messages.upsertevent is emitted (Webhook / RabbitMQ / WebSocket / SQS — all unified througheventManager.emit(), none fire). POST /chat/getBase64FromMediaMessage/{instance}for that messageId returns:TypeError: Cannot read properties of null (reading 'audioMessage')
Root cause
Baileys 7.0.0-rc.9 fails to decrypt secretEncryptedMessage (multi-device sync payload) when the peer is @lid. The unencrypted message object never materializes, so Evolution's repository writes null, and the event dispatcher early-returns before calling eventManager.emit.
Reproduction
- Run
evoapicloud/evolution-api:2.4.0-rc2against a fresh instance. - Pair a phone via QR.
- From the paired phone itself (not the API), record and send an audio to a contact that resolves to
@lid(typically contacts you haven't saved or that haven't whitelisted you). - Watch the DB:
The new row hasSELECT key, "messageType", message IS NULL AS msg_is_null FROM \"Message\" ORDER BY \"messageTimestamp\" DESC LIMIT 5;msg_is_null = true. - No webhook is delivered.
Repeat the same flow with a contact whose remoteJid ends in @s.whatsapp.net → audio dispatched normally.
Repeat with inbound audio from @lid → also dispatched normally.
Fix verified
I patched Evolution 2.4.0-rc2 by overriding the Baileys dependency to 7.0.0-rc12 via a derived image:
FROM evoapicloud/evolution-api:2.4.0-rc2
RUN cd /evolution && npm install --no-save [email protected]
The relevant Baileys release notes:
- 7.0.0-rc10 (2026-05-06): "LID<->PN mappings", "encryption failures handling", "patched fromMe in some scenarios", "multi-device sync rust app state"
- 7.0.0-rc11: libsignal moved to npm
- 7.0.0-rc12 (2026-05-20): security patch GHSA-qvv5-jq5g-4cgg
After the override, fromMe audio from @lid contacts decrypts correctly, message is populated, and messages.upsert fires.
Compatibility audit performed before the patch
- Extracted all destructured imports + member accesses from
dist/**/*.js: 96 distinct Baileys symbols used by Evolution. - All 96 are still exported by 7.0.0-rc12.
- Symbols removed between rc.9 → rc12 (
isJidUser,makeWALegacySocket,generateMessageID,useMultiFileAuthState): not used by Evolution dist code. - Full boot test against production Postgres+Redis (isolated schema): license activated, Prisma ON, WA module ON, zero errors/warnings.
Suggested action
Bump Baileys to 7.0.0-rc12 (or whatever ships ≥ rc10) in the next Evolution release. The override is a one-line package.json change and the dist code is fully compatible.
Related
- #1872 — [META] @lid vs @jid handling umbrella (this is a deeper symptom)
- #2550 —
getBase64FromMediaMessagereturns ephemeralMessage error with iOS audio (samemessage: nullroot cause for the fromMe LID case) - Baileys WhiskeySockets/Baileys#1692 — original LID encryption discussion
Closing — won't pursue further. Thanks.