Skip to content

Editing a text message sets Message.message to JSON null, crashing Manager chat view #2672

Description

@elhanank1

Description

Every time a WhatsApp text message (messageType: conversation) is edited by the sender,
the corresponding row in the Message table has its message column overwritten with a
JSON null instead of the updated content. This appears to be 100% reproducible in our
installation: every row with a MessageUpdate status of EDITED (2 out of 2 observed)
ended up with message = JSON null.

Impact

The Manager UI crashes when opening any chat containing such a message, with:
TypeError: Cannot read properties of null (reading 'contactMessage')
React Router catches it as an unhandled error and the chat screen renders blank/black —
the chat becomes permanently inaccessible in the Manager until the row is fixed directly
in the database.

Environment

  • Evolution API version: 2.3.7
  • Database: PostgreSQL
  • Connector: Baileys (WhatsApp Web)
  • Deployment: Docker (Coolify)

Steps to reproduce

  1. Send a text message from a device (observed with Android as source).
  2. Edit that message from the same device.
  3. Query the Message table: the row's message column is now the JSON scalar null
    (not SQL NULL — "message"::text = 'null'), while MessageUpdate for that message
    shows a status of EDITED.
  4. Open that chat in the Manager UI — it crashes with the TypeError above.

Suspected cause

The messages.update handler (Baileys service) appears to write the incoming update's
message field directly to the database without falling back to the previous/edited
message content when the update payload's message is empty, and the Manager's message
renderer does not null-check message before accessing message.contactMessage /
similar fields.

Workaround

We added a Postgres trigger that preserves the previous message value whenever an
UPDATE would set it to NULL/JSON null, which prevents the crash. Happy to share it,
but a proper fix in the update handler (and a null-check in the Manager renderer) would
be preferable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions