waha icon indicating copy to clipboard operation
waha copied to clipboard

All session Failed

Open team950 opened this issue 4 months ago • 4 comments

all session failed

team950 avatar Jul 29 '26 06:07 team950

Using noweb engine :

  1. get current web whatapp version (example 12345678) : curl -s https://web.whatsapp.com/sw.js | grep -oE 'client_revision[^,}]*'
  2. retain current number session (if not have to scan qr again) : curl -X POST -H "X-Api-Key: YOUR_KEY" -H 'Content-Type: application/json' -d '{"name":"YOUR_WAHA_SESSIONS"}' http://localhost:3000/api/sessions/stop
  3. backup current engine : sudo docker exec CONTAINER_ID cp /app/dist/core/engines/noweb/session.noweb.core.js /app/dist/core/engines/noweb/session.noweb.core.js.bak
  4. inject web whatsapp new version (replace from no 1 which is 12345678): sudo docker exec CONTAINER_ID /bin/sh -c "sed -i '/markOnlineOnConnect: markOnlineOnConnect,/a\ version: [2, 3000, 12345678],' /app/dist/core/engines/noweb/session.noweb.core.js"
  5. check everything : sudo docker exec CONTAINER_ID node --check /app/dist/core/engines/noweb/session.noweb.core.js && echo "syntax OK"
  6. restart container : sudo docker restart CONTAINER_ID -all command in 1 line-

0432x11 avatar Jul 29 '26 06:07 0432x11

i'am already inject web whatsapp new version after restart status = WORKING-STARTING status update every 2 second

mrjay59 avatar Jul 29 '26 07:07 mrjay59

session=EDN_237183 session=EDN_237183 trace=Error: Stream Errored (conflict) at WebSocketClient. (file:///app/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:796:18) at WebSocketClient.emit (node:events:508:28) at file:///app/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:470:35 at processData (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/noise-handler.js:126:13) at process.processTicksAndRejections (node:internal/process/task_queues:103:5) at async Object.decodeFrame (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/noise-handler.js:197:13) at async WebSocketClient.onMessageReceived (file:///app/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:447:9)

mrjay59 avatar Jul 29 '26 07:07 mrjay59

2026.7.2 - NOWEB - fix WhatsApp Web version - #2191

:point_right: https://waha.devlike.pro/docs/engines/noweb/#configuration

:cyclone: Auto-update WhatsApp Web Version

You can resolve the latest WhatsApp Web version right before WAHA starts and pass it via WAHA_NOWEB_WA_VERSION - no need to wait for a new WAHA release.

It’s safe by design: WAHA uses the fetched version only if it’s higher than the built-in one, so a failed or stale fetch simply falls back to the built-in version.

Save the script as fetch-wa-version.js - it prints the latest WhatsApp Web version (like 2.3000.1234567890) to stdout, or prints nothing and exits with code 1 on failure, so WAHA falls back to the built-in version.

Two versions of the script - fetching the version from WhatsApp Web directly (recommended) or from the latest Baileys sources on GitHub:

WhatsApp Web

// Prints the latest WhatsApp Web version (e.g. "2.3000.1234567890") to stdout.
// Prints nothing and exits 1 on failure, so WAHA falls back to the built-in version.
const HEADERS = {
  'sec-fetch-site': 'none',
  'user-agent':
    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
};

async function main() {
  const response = await fetch('https://web.whatsapp.com/sw.js', {
    headers: HEADERS,
    signal: AbortSignal.timeout(15_000),
  });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }
  const text = await response.text();
  const match = text.match(/\\?"client_revision\\?":\s*(\d+)/);
  if (!match) {
    throw new Error('client_revision not found in sw.js');
  }
  console.log(`2.3000.${match[1]}`);
}

main().catch((err) => {
  console.error(`Could not fetch the latest WhatsApp Web version: ${err}`);
  process.exit(1);
});

Baileys

// Prints the WhatsApp Web version pinned in the latest Baileys sources (e.g. "2.3000.1234567890") to stdout.
// Prints nothing and exits 1 on failure, so WAHA falls back to the built-in version.
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts';

async function main() {
  const response = await fetch(URL, { signal: AbortSignal.timeout(15_000) });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }
  const text = await response.text();
  const match = text.match(/const version = \[(\d+),\s*(\d+),\s*(\d+)\]/);
  if (!match) {
    throw new Error('version not found in Defaults/index.ts');
  }
  console.log(`${match[1]}.${match[2]}.${match[3]}`);
}

main().catch((err) => {
  console.error(`Could not fetch the latest WhatsApp Web version: ${err}`);
  process.exit(1);
});

Option 1 - docker-compose (no image build)

Mount the script and wrap the original entrypoint - the version is resolved once per container start:

services:
  waha:
    image: devlikeapro/waha
    volumes:
      - ./fetch-wa-version.js:/fetch-wa-version.js:ro
    entrypoint:
      - /usr/bin/tini
      - --
      - /bin/sh
      - -c
      - |
        export WAHA_NOWEB_WA_VERSION="$${WAHA_NOWEB_WA_VERSION:-$$(node /fetch-wa-version.js)}"
        exec /entrypoint.sh

👉 Note the $$ - Docker Compose interpolates single ${...} itself, so the dollars must be doubled to reach the shell.

Option 2 - your own image on top of WAHA

FROM devlikeapro/waha:latest
COPY fetch-wa-version.js /fetch-wa-version.js
# Original ENTRYPOINT ["/usr/bin/tini", "--"] is inherited - only the CMD changes
CMD ["/bin/sh", "-c", "export WAHA_NOWEB_WA_VERSION=\"${WAHA_NOWEB_WA_VERSION:-$(node /fetch-wa-version.js)}\"; exec /entrypoint.sh"]

A few things to keep in mind:

  • If you set WAHA_NOWEB_WA_VERSION explicitly - it wins over the fetched one (thanks to :- in the wrapper).
  • The version is resolved once per container start - restart the container to pick up a newer version.
  • The fetch URL must be reachable from the container at startup - otherwise WAHA uses the built-in version.

patron:PRO

devlikepro avatar Jul 29 '26 08:07 devlikepro