Skip to content

error: Uncaught (in promise) r: r on await chat.sendStateTyping #201868

Description

@ayelsew

Issue Description

Instance crash down when I simply try to invoke await chat.sendStateTyping().

error: Uncaught (in promise) r: r
  const error = new Error(message);
                ^
    at createEvaluationError (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/utils.js:40:17)
    at ExecutionContext.#evaluate (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:391:56)
    at async ExecutionContext.evaluate (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:277:16)
    at async IsolatedWorld.evaluate (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:16)
    at async CdpFrame.evaluate (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:362:20)
    at async CdpPage.evaluate (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/puppeteer-core@24.38.0/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:830:20)
    at async Client.getChatById (file:///home/ayelsew/Desktop/sideA/node_modules/.deno/whatsapp-web.js@1.34.7/node_modules/whatsapp-web.js/src/Client.js:1694:22)
    at async Client.<anonymous> (file:///home/ayelsew/Desktop/sideA/services/agent_whatsapp/main.ts:22:16)

By debugging the stack trace I found the follow:

{
  exceptionId: 1,
  text: "Uncaught (in promise)",
  lineNumber: 0,
  columnNumber: 0,
  exception: {
    type: "object",
    className: "r",
    description: "r",
    objectId: "-1645228502718693245.1.2",
    preview: {
      type: "object",
      description: "r",
      overflow: true,
      properties: [
        {
          name: "_e",
          type: "object",
          value: "Error\n" +
            "    at j (https://static.whatsapp.net/rsrc.php/v4ikeA4/yJ/l/en_US-j/9HZko7zyvqRgKGqpFRHxNi9lQ…",
          subtype: "error"
        },
        { name: "name", type: "string", value: "DataError" },
        {
          name: "message",
          type: "string",
          value: "Failed to execute 'get' on 'IDBObjectStore': No ke… 'IDBObjectStore': No key or key range specified."
        },
        {
          name: "inner",
          type: "object",
          value: "DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.\n" +
            "    at https…",
          subtype: "error"
        },
        { name: "type", type: "string", value: "error" }
      ]
    }
  }
}

I think it is something related to try to get data from ObjectDB of Chrome. But the chrome I'm using is the one that puppeteer got in the installation process.

Also, after runtime goes down the browser still stays up, so I need to kill it to run the code again.

Reproduction Steps

  1. Get the code sample

  2. run the code

  3. Auth with whatsapp

  4. Send a message

Code Sample

import { Client, LocalAuth } from "whatsapp-web.js";
import qrcode from "qrcode-terminal";

const client = new Client({
  authStrategy: new LocalAuth(),
  puppeteer: {
    executablePath: import.meta.dirname + "/browser/chrome",
    headless: false,
  },
});

client.on("qr", (qr) => {
  qrcode.generate(qr, { small: true });
});

client.on("ready", async () => {
  console.log(await client.getWWebVersion());
  console.log("Client is ready!");
});

client.on("message", async (msg) => {
  const chat = await msg.getChat();

await chat.sendStateTyping();
});

client.initialize();

User Setup

WhatsApp Type
Account Type WhatsApp Business
Authentication Strategy LocalAuth
WhatsApp Web Version 2.3000.1044071294
whatsapp-web.js Version 1.34.7
Environment Version
Browser Type Google Chrome
Browser Version 146.0.7680.31
Phone OS Version Android 16
Running OS Version Garuda Linux
Node.js Version 26.4.0

Checklist

  • I use the latest released version of whatsapp-web.js.
  • I have searched existing issues and confirmed this is not a duplicate.
  • I have verified this is a library issue, not a problem with my code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokenissued mediumMedium impact issuetypingsType definitions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions