waha icon indicating copy to clipboard operation
waha copied to clipboard

[Chatwoot Integration] WAHA attempts to send media before upload is complete on external storage (Wasabi S3)

Open MrDandi79 opened this issue 2 months ago โ€ข 11 comments

When integrating Chatwoot โ†’ WAHA (GoWS Plus) with external S3-compatible storage (Wasabi), WAHA attempts to send the media file before the upload is fully propagated or publicly accessible, resulting in a 404 error.

This leads to 2โ€“3 failed attempts before the final retry succeeds.


๐Ÿ’ก Steps to reproduce

  1. Configure Chatwoot with external Active Storage (Wasabi S3):

    ACTIVE_STORAGE_SERVICE=s3_compatible STORAGE_ENDPOINT=https://s3.wasabisys.com
  2. Connect WAHA Plus (GoWS) to Chatwoot via /api/sendFile.

  3. Send a large attachment (e.g. 15โ€“30 MB ZIP or XLSX).

  4. Observe WAHA logs:

    • First attempt โ†’ AxiosError: 404

    • Second attempt โ†’ AxiosError: 404

    • Third attempt โ†’ success.


๐Ÿง  Expected behavior

WAHA should wait a few seconds before attempting to download and send the file, or allow configuration of a delay (backoff) between upload and media fetch.


โš™๏ธ Current behavior

  • WAHA calls fileToMedia() immediately after receiving the webhook from Chatwoot.

  • At this point, the file URL (Active Storage redirect) still points to an object that isn't yet available in Wasabi.

  • WAHA retries automatically but without a configurable delay, resulting in multiple unnecessary 404s.


๐Ÿงฉ Suggested solution

  • Introduce an environment variable to delay the first attempt of media download, such as:

    WAHA_MEDIA_SEND_DELAY_MS=5000

    or

    WAHA_APPS_JOBS_BACKOFF=5000
  • Alternatively, WAHA could check file availability (HTTP 200) before proceeding.


๐Ÿงพ Environment

Component | Version -- | -- WAHA Version | 2025.9.7 (Plus, GoWS) Chatwoot | 3.x (Active Storage + Wasabi) Storage | Wasabi S3 (s3.wasabisys.com) OS | Ubuntu 24.04 (Easypanel VPS, 8GB RAM, 100GB SSD)

MrDandi79 avatar Oct 04 '25 14:10 MrDandi79