-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
Bug Description
Discord inbound attachments (.txt, .md, images) fail to download silently when a proxy is configured for the Discord channel. The attachment file never appears in ~/.openclaw/media/inbound/, and the error is only logged via logVerbose() which is suppressed at normal log levels.
Root Cause Analysis
In processDiscordMessage() → resolveMediaList() → appendResolvedMediaFromAttachments(), the call to fetchRemoteMedia() does NOT pass through the configured proxy's fetchImpl:
// Discord (broken) - no fetchImpl/proxy
const fetched = await fetchRemoteMedia({
url: attachment.url,
filePathHint: attachment.filename ?? attachment.url,
maxBytes: params.maxBytes
});While fetchRemoteMedia() supports a fetchImpl parameter, and other channels (e.g., Telegram) correctly pass proxyFetch through their pipeline, the Discord implementation does not.
Node.js native fetch() (undici) does NOT honor HTTP_PROXY/HTTPS_PROXY environment variables and requires an explicit ProxyAgent dispatcher. This means Discord attachment downloads always use direct connections, bypassing the proxy configured in channels.discord.proxy.
Environment
- OpenClaw version: 2026.2.23
- Platform: macOS (Apple Silicon)
- Proxy: v2rayN/xray on
127.0.0.1:10808(configured inchannels.discord.proxy) - DNS resolution:
cdn.discordapp.comresolves to108.160.165.53(Fastly CDN, public IP) - Region: China (Discord CDN blocked without proxy)
Steps to Reproduce
- Configure Discord channel with a proxy:
"proxy": "http://127.0.0.1:10808" - Send a
.txtfile attachment to the bot via Discord DM - Observe that the bot receives the text message but NOT the attachment content
- Check
~/.openclaw/media/inbound/— no new file appears - No error in standard logs (only visible with verbose logging enabled)
Expected Behavior
appendResolvedMediaFromAttachments() should use the same proxy configured in channels.discord.proxy when calling fetchRemoteMedia(), consistent with how Telegram handles media downloads.
Related Issues
- Discord: inbound image attachments not delivered to agent when proxy is configured #22575 - Discord inbound image attachments not delivered when proxy configured
- Bug: SSRF protection incorrectly blocks Telegram media downloads after 2026.2.22 update #25111 - SSRF blocks media after v2026.2.22
- Allow configuring SSRF policy for channel media fetches (Surge/proxy fake-IP compatibility) #25086 - Allow configuring SSRF policy for channel media fetches
Suggested Fix
Thread the Discord channel's proxy fetchImpl through the call chain:
// In resolveMediaList / appendResolvedMediaFromAttachments
const fetched = await fetchRemoteMedia({
url: attachment.url,
filePathHint: attachment.filename ?? attachment.url,
maxBytes: params.maxBytes,
fetchImpl: proxyFetch // from Discord channel config
});