Skip to content

sendMessage returns a valid message ID but no ACK; message remains "Waiting for this message" and session later logs out #201849

Description

@qwleoz

Issue Description

After recent WhatsApp Web updates, client.sendMessage() intermittently returns a valid message object and serialized ID, but the message is not successfully delivered.

The failure has been reproduced both with a minimal probe and with the regular application:

  1. A freshly linked LocalAuth session initially sends messages normally.
  2. Successful messages receive ACK 1, followed by ACK 2/3.
  3. After some time, sendMessage() still resolves and returns a valid message ID.
  4. No message_ack event is received for that ID, including ACK 1.
  5. The affected message appears as "Waiting for this message. This may take a while."
  6. client.getState() may still report CONNECTED.
  7. The session later becomes invalid and WhatsApp Web navigates to:

https://web.whatsapp.com/?post_logout=1

Relinking the session from scratch only resolves the problem temporarily.

This is not merely an application-side SEND-OK interpretation: the application now treats the return from sendMessage() only as SEND-RETURNED and waits up to 60 seconds for ACK 1. The failed messages never receive it.

Relevant Log Sequence

[SEND-TRY] state=CONNECTED
[SEND-RETURNED] msgId=<valid serialized ID>; waiting for ACK 1
[STATE] CONNECTED
[SEND-UNVERIFIED] sendMessage returned <same ID>, but ACK 1 was not received within 60000ms

Immediately preceding messages in the same session received ACK 1, 2 and 3 normally.

During the subsequent restart, the captured page diagnostics showed:

{
  "url": "https://web.whatsapp.com/?post_logout=1",
  "readyState": "loading"
}

Puppeteer then reported Execution context was destroyed while WhatsApp Web was navigating. This appears to be a consequence of the logout/navigation, rather than the initial sending failure.

Steps To Reproduce

  1. Create a client using LocalAuth.
  2. Link a fresh session using QR.
  3. Send periodic text messages to a dedicated test group.
  4. Record the returned message ID and all message_ack events.
  5. Initially, messages receive ACK 1/2/3.
  6. Eventually, sendMessage() may return a valid ID without any ACK.
  7. Check the affected message on linked devices.
  8. Continue monitoring the page/session; it may redirect to ?post_logout=1.

The failure is intermittent and may require several hours.

Code Sample

const { Client, LocalAuth } = require('whatsapp-web.js');

const client = new Client({
    authStrategy: new LocalAuth({ clientId: 'ack-test' })
});

const groupId = 'REPLACE_WITH_TEST_GROUP_ID@g.us';

client.on('ready', async () => {
    console.log('WhatsApp Web version:', await client.getWWebVersion());

    const sendProbe = async () => {
        const message = await client.sendMessage(
            groupId,
            `ACK test ${new Date().toISOString()}`
        );

        console.log('SEND-RETURNED:', message.id._serialized);
    };

    await sendProbe();
    setInterval(sendProbe, 15 * 60 * 1000);
});

client.on('message_ack', (message, ack) => {
    console.log('ACK:', ack, 'ID:', message.id._serialized);
});

client.on('disconnected', reason => {
    console.log('DISCONNECTED:', reason);
});

client.initialize();

Environment

  • Account type: Standard
  • Authentication: LocalAuth
  • whatsapp-web.js: 1.34.7
  • WhatsApp Web version observed: 2.3000.1043332421
  • Browser: Chromium 146.0.7680.31
  • Node.js: 20.19.5
  • OS: Ubuntu 22.04.5 LTS
  • Primary phone: Android 14
  • Primary phone WhatsApp: 2.26.27.85

The installed package is npm release 1.34.7 with a local patch-package equivalent of PR #201848 for the $1 serialized-ID compatibility change. The earlier PR #201832 fork is no longer installed.

The $1 patch fixes the previous r: r exception, but it does not prevent this missing-ACK / waiting-message / logout sequence.

Additional Isolation

The same missing-ACK behavior occurred in a minimal probe without Firestore event processing.

During application testing, these operations were also disabled:

  • getChats()
  • getChatById()
  • msg.getChat()
  • sendSeen()
  • Chat synchronization

Therefore, the failure is not dependent on those operations.

Possibly Related

Issue #201770 reports the same unexpected LOGOUT navigation to
?post_logout=1 using whatsapp-web.js 1.34.7 and Chromium 146.

The present report adds a preceding observable failure: sendMessage()
returns a valid ID, but ACK 1 stops arriving before the session is logged out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokenbuildBuild systemdependenciesDependency updatesissued mediumMedium impact issuetestsTest relatedtypingsType definitions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions