Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waiting for ripe session bug #3178

Closed
1 task done
joelvitorniino opened this issue Mar 29, 2024 · 3 comments
Closed
1 task done

Waiting for ripe session bug #3178

joelvitorniino opened this issue Mar 29, 2024 · 3 comments

Comments

@joelvitorniino
Copy link

Are you using the latest version of the library?

  • I have checked and am using the latest version of the library.

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

Waiting for ripe session bug

Expected Behavior

Waiting for ripe session bug

Steps To Reproduce

yarn tsx src/app.ts

image

create() code OR full CLI command + CONFIG

import { config } from "dotenv";
import { ChatId, create, Client, Message } from "@open-wa/wa-automate";
import PQueue from "p-queue";
import { CommandExecuter } from "./class/CommandExecuter";

config();

const pqueue = new PQueue({
  concurrency: 1,
  intervalCap: 1,
  carryoverConcurrencyCount: true,
});

let warningMessageSent = false; 

export const initializeApp = async (): Promise<void> => {
  const commandExecuter = new CommandExecuter(__dirname + "/modules/commands");

  const handleMessage = async (client: Client, message: Message) => {
    try {
      const commandRegex = /^!([\w-]+)(?:\s+(.*))?$/;
      const matches = message.body?.match(commandRegex);
      const from = message.from;

      const commandName = matches![1].toLowerCase();

      if (!warningMessageSent) {
        await client.sendText(from, 'Caso o comando demore a ser enviado, é por que estamos operando em filas paralelas!');
        warningMessageSent = true;
      }

      await pqueue.add(async () => {
        await commandExecuter.enqueueCommand(
          client,
          commandName,
          from,
          matches!
        );
      });

      await client.clearAllChats();

      const chat = await client.getAllChatIds()

      chat.forEach(async ch => {
        const result = await client.archiveChat(ch, true);
      });
    } catch {
      return null;
    }
  };

  const startClient = async () => {
    const client = await create({
      authTimeout: 20000,
      bypassCSP: true,
      cachedPatch: true,
      cacheEnabled: false,
      chromiumArgs: [
        "--no-sandbox",
        "--disable-setuid-sandbox",
        "--disable-dev-shm-usage",
        "--disable-accelerated-2d-canvas",
        "--no-first-run",
        "--no-zygote",
        "--single-process",
        "--disable-gpu",
        "--ignore-certificate-errors",
      ],
      corsFix: true,
      sessionId: "niino",
      useChrome: true,
      headless: true,
    });

    client.onMessage(async (message) => {
      await handleMessage(client, message);
    });
  };

  startClient();
};

initializeApp();

DEBUG INFO

WA_VERSION      │                                                            '2.3000.1012412840'                                                             │
│       PAGE_UA       │ 'WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36' │
│ WA_AUTOMATE_VERSION │                                                                  '4.68.0'                                                                  │
│   BROWSER_VERSION   │                                                       'HeadlessChrome/123.0.6312.86'                                                       │
│         OS          │                                                                'Linux 6.8'                                                                 │
│      START_TS       │                                                               1711745568601                                                                │
│      RAM_INFO       │                                                     'Total: 16.71 GB | Free: 11.39 GB'                                                     │
│    PPTR_VERSION     │                                                                 '19.11.1'                                                                  │

Environment

- OS: Linux 6.8
- Node: 20.10.0
- npm: 10.2.5

Screenshots/Logs

-x-

Anything else?

-x-

@TVARecordings
Copy link

Hello @joelvitorniino,

I'm not a developer of WA-Automate-Nodejs, but i'm in the dedicated Discord-server. Last month @smashah announced they're expecting that Whatsapp-web's (the site) framework will be updated.

@smashah Has not publicly announced this yet, but the bug you're experiencing, do experience other users too.
This is possibly caused by Whatsapp updating their framework.

For now, a temporary fix i have found is doing this:

Close the application (npm, mp2, whatever you use), delete the IGNORE folder & delete the .data.json file.
Relaunch the application and connect the host via QR again.
Yes, you need to do this every time.

@joelvitorniino
Copy link
Author

joelvitorniino commented Apr 1, 2024 via email

@smashah
Copy link
Member

smashah commented Apr 7, 2024

Rolling into #3184

@smashah smashah closed this as completed Apr 7, 2024
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

No branches or pull requests

3 participants