[BUG] Inbound messages received by Baileys are not emitted as MESSAGES_UPSERT webhooks; instance gets stuck and cannot be deleted until restart
Los mantenedores suelen responder en 8 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
- Stack tecnológico
- docker-compose, postgresql, redis, typescript
Línea de trabajo
Trace the Baileys inbound message path from receipt through MESSAGES_UPSERT and webhook dispatch, then compare it with the instance delete/logout path. Start with the TRACE and Baileys logs, including the LID/PN, session, and decryption errors. Done means affected inbound messages produce webhooks and the connected instance remains manageable without a restart.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Welcome!
- Yes, I have searched for similar issues on GitHub and found none.
What did you do?
We are running Evolution API in production using a Baileys WhatsApp instance with webhook integration to n8n.
The system works normally for most messages. However, after the instance runs for some time, some inbound customer messages become visible in the WhatsApp mobile app but do not trigger a MESSAGES_UPSERT webhook.
To debug this, we enabled trace logging:
LOG_LEVEL=TRACE
LOG_BAILEYS=trace
LOG_COLOR=false
Then we compared the same affected message time windows across:
- WhatsApp mobile app message timestamps
- Evolution/Baileys container logs
- Reverse proxy logs
- n8n execution logs
We found multiple cases where the inbound message reached the Evolution/Baileys layer, but no webhook POST was sent to n8n.
We also noticed that around the same time this starts happening, Evolution Manager sometimes fails to delete the affected instance and shows:
Error: [object Object]
After restarting only the evolution-api container, the delete action works again.
If we delete and reconnect a fresh instance, webhook delivery becomes stable again for a few days, then the issue returns.
What did you expect?
Every inbound WhatsApp text message received by the Baileys socket should emit a normal MESSAGES_UPSERT webhook to the configured webhook URL.
If Evolution cannot process or emit the message, it should log a clear error explaining why the webhook was not emitted.
The instance should also remain manageable from Evolution Manager. Actions like delete/logout should not fail while the instance is shown as connected.
What did you observe instead of what you expected?
Some inbound WhatsApp messages are visible in the WhatsApp mobile app, but Evolution does not emit a MESSAGES_UPSERT webhook for those messages.
For affected messages:
- No HTTP POST reaches the reverse proxy
- No n8n execution is created
- No downstream chat history row is created
- Sometimes the message appears in Evolution/Baileys logs as a raw packet
- Sometimes the message is even parsed/readable in Evolution logs, but still no webhook is dispatched
- Sometimes the message appears later through a delayed/raw/sync-like path, but still no webhook is emitted
We observed these patterns:
Pattern 1: Message readable in Evolution logs, but no webhook
A customer sent:
Please place the order
Evolution/Baileys logs showed a readable message object:
remoteJid: [email protected]
remoteJidAlt: [email protected]
conversation: "Please place the order"
But during the same time window:
No messages.upsert event
No webhook dispatch log
No HTTP POST in reverse proxy logs
No n8n execution
Pattern 2: Raw encrypted packet received, but no readable conversation and no webhook
Another affected message appeared as:
<message from="REDACTED_LID@lid" type="text" id="REDACTED_MESSAGE_ID" notify="REDACTED_NAME" sender_pn="[email protected]">
<enc v="2" type="pkmsg">REDACTED_ENCRYPTED_PAYLOAD</enc>
</message>
Then Evolution logged PN/LID mapping and device/session activity, but no readable conversation: object and no webhook.
Pattern 3: Message appears later in logs but never emits webhook
One customer message was visible in WhatsApp at the original send time. Evolution did not emit a webhook at that time.
Around one hour later, Evolution logs showed the same message ID and sender number in a raw/sync-like path:
<message from="REDACTED_LID@lid"
type="text"
id="REDACTED_MESSAGE_ID"
offline="0"
notify="REDACTED_NAME"
sender_pn="[email protected]"
t="REDACTED_TIMESTAMP">
<url_number />
<unavailable />
</message>
The same message ID later appeared again with encrypted content:
<message from="REDACTED_LID@lid"
type="text"
id="REDACTED_MESSAGE_ID"
sender_pn="[email protected]">
<enc v="2" type="pkmsg">REDACTED_ENCRYPTED_PAYLOAD</enc>
</message>
But again there was:
No readable conversation
No messages.upsert webhook
No HTTP POST to n8n
Around the same period, Evolution Manager sometimes cannot delete the instance and shows:
Error: [object Object]
After restarting the evolution-api container, the delete action works again.
Screenshots/Videos
I can provide screenshots and additional logs if needed.
For privacy/security reasons, I am not attaching production screenshots in the initial report because they contain customer phone numbers, profile names, instance names, webhook URLs, and internal workflow details.
Available evidence if maintainers need it:
- Evolution Manager delete error screenshot (
Error: [object Object]) - WhatsApp screenshot showing the inbound message visible in the app
- n8n execution window showing no execution for the affected timestamp
- Sanitized Evolution/Baileys logs
- Sanitized reverse proxy logs showing no HTTP POST for the affected message window
Which version of the API are you using?
2.3.7
What is your environment?
Linux
Other environment specifications
Deployment:
- Ubuntu Linux server
- Docker Compose
- Evolution API container
- PostgreSQL enabled
- Redis enabled
- Reverse proxy in front of n8n
- n8n webhook receiver
- WhatsApp instance type: Baileys / WhatsApp Web
Relevant Evolution environment settings:
LOG_LEVEL=TRACE
LOG_BAILEYS=trace
LOG_COLOR=false
REDIS_ENABLED=true
REDIS_URI=redis://redis:6379/1
REDIS_PREFIX_KEY=evocore
CACHE_REDIS_ENABLED=true
CACHE_REDIS_URI=redis://redis:6379/2
CACHE_REDIS_PREFIX_KEY=evocache
CACHE_LOCAL_ENABLED=false
DATABASE_ENABLED=true
DATABASE_PROVIDER=postgresql
STORE_MESSAGES=false
STORE_MESSAGE_UP=false
STORE_CONTACTS=false
STORE_CHATS=false
NODE_OPTIONS=--max-old-space-size=1024
Main enabled event:
MESSAGES_UPSERT
Traffic source:
- Normal WhatsApp customer messages
- Click-to-WhatsApp ads from Facebook/Instagram
If applicable, paste the log output
Sanitized log samples:
Raw message packet received
<message from="REDACTED_LID@lid"
type="text"
id="REDACTED_MESSAGE_ID"
offline="0"
notify="REDACTED_NAME"
sender_pn="[email protected]"
t="REDACTED_TIMESTAMP">
<url_number />
<unavailable />
</message>
Same message ID later appears with encrypted content
<message from="REDACTED_LID@lid"
type="text"
id="REDACTED_MESSAGE_ID"
sender_pn="[email protected]">
<enc v="2" type="pkmsg">REDACTED_ENCRYPTED_PAYLOAD</enc>
</message>
PN/LID mapping and device migration logs
Cache miss for PN user 94XXXXXXXXX; checking database
Storing 1 pn mappings
bulk device migration - loading all user devices
sent ack
LID mapping already exists, skipping
Example of readable message with no webhook
remoteJid: [email protected]
remoteJidAlt: [email protected]
conversation: "Please place the order"
But for the same message window:
No messages.upsert event
No webhook dispatch log
No HTTP POST in reverse proxy logs
No n8n execution
Other related errors seen during affected periods
Failed to decrypt message with any known session
Session error: Error: Bad MAC
Decrypted message with closed session
Invalid patch mac
failed to sync state from version, removing and trying from scratch
Downstream verification
For the affected message windows:
No webhook POST in reverse proxy logs
No n8n execution
No downstream chat_history row
Additional Notes
This is production-impacting because customer messages are silently missed.
Important observations:
- Restarting the
evolution-apicontainer temporarily restores Manager actions such as delete. - Deleting the old instance and creating/reconnecting a fresh instance temporarily fixes message delivery for a few days.
- After several days of production usage, the issue returns.
- This suggests the Baileys/Evolution instance state may degrade or become desynced over time.
- The issue seems related to LID/PN mapping, session/pre-key state, app-state sync, event buffering, or webhook emission.
Questions:
- Is this a known issue in v2.3.7?
- Could this be related to LID/PN mapping, app-state sync, pre-key/session state, or event buffer flushing?
- Is there a safe way to repair/reset an instance state without deleting and reconnecting it?
- Should we enable
STORE_MESSAGES,STORE_MESSAGE_UP,STORE_CHATS, or other storage options to improve recovery? - Is it recommended to enable additional events such as
MESSAGES_SET,MESSAGES_UPDATE, orCHATS_UPDATEto recover messages that do not emit asMESSAGES_UPSERT? - Should we avoid using
latestand pin a specific stable version? - Is there a recommended stable version for production use with Redis + PostgreSQL + Baileys?
- Lenguaje dominante
- TypeScript
- Estrellas
- 9.8k
- Forks
- 7.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de evolution-foundation/evolution-api
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
evolution-foundation/evolution-api#2723 ·
Los mantenedores suelen responder en 8 días
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
evolution-foundation/evolution-api#2704 ·
Los mantenedores suelen responder en 8 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
evolution-foundation/evolution-api#2702 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 8 días
-
[BUG] Cloud API: a single unknown wamid in a `statuses` batch silently drops the whole batch (`return` instead of `continue`)Posiblemente ocupada @vin1i la tomó hace 43 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
evolution-foundation/evolution-api#2700 · 1 comentario ·
Los mantenedores suelen responder en 8 días
-
[BUG] Chatwoot integration duplicates messages when a device re-delivers the same key.id — getExistingSourceIds exists but is never called on the live pathPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
evolution-foundation/evolution-api#2675 ·
Los mantenedores suelen responder en 8 días
Todos los issues de evolution-foundation/evolution-api
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
JoviDeCroock/pracht#432 ·
Los mantenedores suelen responder en 1 día
-
Add: CNN en Espanol SDAbiertoapproved check:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Hardware attribute name "app Connection Support" has inconsistent casingPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
walletbeat/walletbeat#1628 ·
Los mantenedores suelen responder en 1 día
-
bug go
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
genkit-ai/genkit#6761 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NousResearch/hermes-agent#136483 ·
Los mantenedores suelen responder en 1 día