Skip to content

[Feature] - Media files fetching doesn't respect Proxy settings - NOWEB, GOWS, WEBJS #1801

@Horbatenko

Description

@Horbatenko

Describe the bug

We try to launch WAHA in a private VPS, which is isolated from the network and accessible only via Proxy.
Once the proxy is set for a session, we can receive and process events, but there is an issue with Media files fetching.
The download request to mmg.whatsapp.net:443 fails with a timeout (similar to the behavior with no Proxy set for the regular events in our case)

Version

GET /api/version
{
    "version": "2026.1.1",
    "engine": "NOWEB",
    "tier": "CORE",
    "browser": null,
    "platform": "linux/x64"
}

Steps

To Reproduce Steps to reproduce the behavior:

  1. <VPS, accessible only via proxy>
  2. Open the dashboard
  3. Set up a session, specify Proxy (for some reason, WAHA does not pick up the proxy setting from WHATSAPP_PROXY_SERVER, only a per-session approach works)
  4. Start the session
  5. Send media file to a chat
  6. Open container logs

logs example

{"level":30,"time":1768223520448,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"The message 3B579E966A1D69B7C7E6 has media, downloading it..."}
{"level":20,"time":1768223520448,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":20,"time":1768223531055,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":20,"time":1768223541746,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":20,"time":1768223552635,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":20,"time":1768223563626,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":20,"time":1768223574618,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","msg":"Fetching media from WhatsApp message '3B579E966A1D69B7C7E6'..."}
{"level":50,"time":1768223585110,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","err":{"type":"TypeError","message":"fetch failed: Connect Timeout Error (attempted address: mmg.whatsapp.net:443, timeout: 10000ms)","stack":"TypeError: fetch failed\n    at node:internal/deps/undici/undici:15845:13\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async getHttpStream (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages-media.js:299:22)\n    at async downloadEncryptedContent (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages-media.js:457:21)\n    at async downloadMsg (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:846:24)\n    at async downloadMediaMessage (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:810:20)\n    at async NOWEBEngineMediaProcessor.getMediaBuffer (/app/dist/core/engines/noweb/session.noweb.core.js:2188:17)\n    at async MediaManager.fetchMedia (/app/dist/core/media/MediaManager.js:95:24)\n    at async MediaManager.withRetry (/app/dist/core/media/MediaManager.js:119:20)\n    at async MediaManager.processMediaInternal (/app/dist/core/media/MediaManager.js:55:28)\n    at async MediaManager.processMedia (/app/dist/core/media/MediaManager.js:82:26)\n    at async WhatsappSessionNoWebCore.downloadMediaSafe (/app/dist/core/engines/noweb/session.noweb.core.js:1764:20)\n    at async WhatsappSessionNoWebCore.processIncomingMessage (/app/dist/core/engines/noweb/session.noweb.core.js:1557:27)\ncaused by: ConnectTimeoutError: Connect Timeout Error (attempted address: mmg.whatsapp.net:443, timeout: 10000ms)\n    at onConnectTimeout (/app/node_modules/undici/lib/core/util.js:876:19)\n    at Immediate._onImmediate (/app/node_modules/undici/lib/core/util.js:845:11)\n    at process.processImmediate (node:internal/timers:504:21)"},"msg":"Failed to execute 'Fetching media', tried '5' times"}
{"level":50,"time":1768223585114,"pid":7,"hostname":"c5e84605946f","reqId":480,"session":"default","name":"MediaManager","err":{"type":"TypeError","message":"fetch failed: Connect Timeout Error (attempted address: mmg.whatsapp.net:443, timeout: 10000ms)","stack":"TypeError: fetch failed\n    at node:internal/deps/undici/undici:15845:13\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async getHttpStream (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages-media.js:299:22)\n    at async downloadEncryptedContent (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages-media.js:457:21)\n    at async downloadMsg (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:846:24)\n    at async downloadMediaMessage (file:///app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:810:20)\n    at async NOWEBEngineMediaProcessor.getMediaBuffer (/app/dist/core/engines/noweb/session.noweb.core.js:2188:17)\n    at async MediaManager.fetchMedia (/app/dist/core/media/MediaManager.js:95:24)\n    at async MediaManager.withRetry (/app/dist/core/media/MediaManager.js:119:20)\n    at async MediaManager.processMediaInternal (/app/dist/core/media/MediaManager.js:55:28)\n    at async MediaManager.processMedia (/app/dist/core/media/MediaManager.js:82:26)\n    at async WhatsappSessionNoWebCore.downloadMediaSafe (/app/dist/core/engines/noweb/session.noweb.core.js:1764:20)\n    at async WhatsappSessionNoWebCore.processIncomingMessage (/app/dist/core/engines/noweb/session.noweb.core.js:1557:27)\ncaused by: ConnectTimeoutError: Connect Timeout Error (attempted address: mmg.whatsapp.net:443, timeout: 10000ms)\n    at onConnectTimeout (/app/node_modules/undici/lib/core/util.js:876:19)\n    at Immediate._onImmediate (/app/node_modules/undici/lib/core/util.js:845:11)\n    at process.processImmediate (node:internal/timers:504:21)"},"msg":"Error processing media for message '3B579E966A1D69B7C7E6'"}

Expected behavior

Media assets get downloaded

Additional context

Our env settings example

WHATSAPP_PROXY_SERVER=host:port

HTTP_PROXY=http://host:port
HTTPS_PROXY=http://host:port
NO_PROXY=...

...
WAHA_MEDIA_STORAGE=LOCAL
WHATSAPP_FILES_LIFETIME=3600  # 1 hour
WHATSAPP_FILES_FOLDER=/app/.media

WHATSAPP_DOWNLOAD_MEDIA=true

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions