Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BAILEYS][Chatwoot App] readMessages on @lid chats routes to WEBJS getChat -> 500, blocks outbound send

Aperta
#2,115 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
node.js, typescript
Ambito
api, backend

Direzione di ricerca

Start by tracing ChatWootInboxMessageCreatedConsumer in message_created.js, where readMessages runs before sendText, then follow the session implementation selected for the BAILEYS engine and the @lid read endpoint. Check related issues #1782, #1810, and #1985 for context. Done means BAILEYS @lid messages can be sent even when marking the chat as read fails or uses the wrong engine.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

GitHub Issue — devlikeapro/waha

Title: [BAILEYS][Chatwoot App] readMessages on @lid chats routes to WEBJS getChat → 500, blocks outbound send

Description

Environment
  • WAHA version: 2026.5.1 (GET /api/version or error payload version.version)
  • Image: devlikeapro/waha:latest (digest truncated)
  • Engine: WHATSAPP_DEFAULT_ENGINE=BAILEYS
  • WAHA Apps: WAHA_APPS_ON=chatwoot
  • Platform: linux/x64, tier CORE
Steps to reproduce
  1. Run WAHA with BAILEYS engine and Chatwoot app enabled (inbox API channel).
  2. Ensure a Chatwoot contact has custom_attributes.wa_lid (e.g. {numeric_id}@lid) — normal for WhatsApp privacy / Linked ID.
  3. Create an outgoing message in Chatwoot inbox (or via API) so ChatWootInboxMessageCreatedConsumer runs.
  4. Observe job chatwoot.inbox | message_created fail after 3 retries.
Expected behavior
  • sendTextMessage should deliver to WhatsApp even if mark-as-read fails, or
  • readMessages on BAILEYS session should use Baileys implementation, not WEBJS.
Actual behavior

MessageHandler.sendTextMessage calls await session.readMessages(chatId) before sendText:

// /app/dist/apps/chatwoot/consumers/inbox/message_created.js (~line 163)
await session.readMessages(chatId);
await session.startTyping(...);
const msg = await session.sendText(request);

For @lid chat IDs, internal API call fails:

POST /api/default/chats/{lid}@lid/messages/read
→ 500 TypeError: Cannot read properties of undefined (reading 'getChat')

Stack trace shows WEBJS path while session reports BAILEYS:

WhatsappSessionWebJSCore.readChatMessages (session.webjs.core.js:608)
WebjsClientCore.getChatById (whatsapp-web.js Client.js:1171)
WPage.evaluate (webjs/WPage.js:13)

Version block in error JSON:

"version": { "version": "2026.5.1", "engine": "BAILEYS", "tier": "CORE" }

Outbound WhatsApp messages never send because the exception aborts before sendText.

Workaround (local patch)

Wrap readMessages in try/catch in message_created.js so send proceeds:

try { await session.readMessages(chatId); } catch (e) { this.logger.warn(`Skip readMessages: ${e?.message}`); }
Suggested fix (upstream)
  1. Implement readChatMessages for BAILEYS engine (or route by active engine, not WEBJS fallback).
  2. In Chatwoot app consumer: do not fail the whole send if readMessages fails (non-fatal).
  3. Resolve @lid → @c.us via /api/{session}/lids/{lid} before read, when applicable.
Related issues
  • #1782, #1810, #1985 — similar getChat / WEBJS undefined Store errors on @lid chats

Issue filed: https://github.com/devlikeapro/waha/issues/2115

Lingua principale
TypeScript
Stelle
7.6k
Fork
1.8k
Merge medio
2g 21h
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devlikeapro/waha

Tutte le issue di devlikeapro/waha

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.