openclaw - 💡(How to fix) Fix Title channels.discord.proxy does not proxy REST API requests — guild resolve fails, guild channels broken behind HTTP proxy [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49990Fetched 2026-04-08 01:00:28
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

channels.discord.proxy only proxies the Discord WebSocket Gateway connection but not startup REST API requests (guild resolve, deploy commands, fetch bot identity), causing all REST calls to fetch failed and guild channels to be completely non-functional in network environments that require an HTTP proxy to reach Discord.

Error Message

[discord] startup [default] deploy-rest:put:error 11291ms error=fetch failed ❌ | ✅ | ❌ TLS error | ✅ | ❌

Root Cause

channels.discord.proxy only proxies the Discord WebSocket Gateway connection but not startup REST API requests (guild resolve, deploy commands, fetch bot identity), causing all REST calls to fetch failed and guild channels to be completely non-functional in network environments that require an HTTP proxy to reach Discord.

Fix Action

Fix / Workaround

Startup log excerpt: [discord] rest proxy enabled [discord] channels unresolved: guild:<id> (guildId:<id>) [discord] startup [default] deploy-rest:put:error 11291ms error=fetch failed [discord] discord: failed to deploy native commands: fetch failed [discord] discord: failed to fetch bot identity: TypeError: fetch failed [discord] logged in to discord Verification that proxy itself works (same proxy, same machine): bashcurl -x http://127.0.0.1:7890 https://discord.com/api/v10/users/@me -H "Authorization: Bot <token>"

Returns 200 OK with bot identity JSON

Node.js built-in fetch does not support proxy: bashnode -e "fetch('https://discord.com/api/v10/users/@me').then(r=>console.log(r.status)).catch(e=>console.log(e.message))"

Output: fetch failed

Workaround with undici ProxyAgent fixes REST but not guild resolve: bashNODE_OPTIONS="--require proxy-bootstrap.js" openclaw gateway --force

proxy-bootstrap.js: setGlobalDispatcher(new ProxyAgent('http://127.0.0.1:7890'))

Result: REST calls succeed, WebSocket connects, but guild still unresolved

</div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Key findings:</strong></p> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Node.js 25.8.0 built-in <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">fetch</code> (undici) does not respect <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">HTTP_PROXY</code>/<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">HTTPS_PROXY</code> env vars or system proxy settings</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> only applies to the WebSocket Gateway connection, not REST API calls</li> <li class="whitespace-normal break-words pl-2">Guild resolve appears to use a separate code path that neither <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> nor global <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">setGlobalDispatcher</code> covers</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openclaw channels resolve --channel discord --kind group &lt;guild_id&gt;</code> succeeds when run as a separate CLI command with the ProxyAgent bootstrap, confirming the guild data is accessible</li> <li class="whitespace-normal break-words pl-2">The same bot + config worked correctly on a cloud server (Tencent Cloud) with direct Discord access (no proxy needed), confirming this is proxy-specific</li> </ul> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Suggested fix:</strong> Apply <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> to the undici dispatcher for all REST API calls during Discord provider startup, not just WebSocket. Consider supporting a global proxy config (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">gateway.proxy</code> or <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">network.proxy</code>) that sets a global undici <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">ProxyAgent</code>. Ensure guild resolve uses the same proxied HTTP path and has retry logic.</p>
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

channels.discord.proxy only proxies the Discord WebSocket Gateway connection but not startup REST API requests (guild resolve, deploy commands, fetch bot identity), causing all REST calls to fetch failed and guild channels to be completely non-functional in network environments that require an HTTP proxy to reach Discord.

Steps to reproduce

Steps to reproduce

Set up OpenClaw on a machine that requires an HTTP proxy to reach Discord (e.g., behind a corporate firewall or in a region where Discord is not directly accessible). Configure Discord channel with proxy:

json{ "channels": { "discord": { "enabled": true, "proxy": "http://127.0.0.1:7890", "groupPolicy": "allowlist", "guilds": { "<guild_id>": { "requireMention": false, "users": ["<user_id>"] } } } } }

Run openclaw gateway --force. Observe startup logs: WebSocket connects successfully, but REST API calls (deploy-rest:put, fetch-bot-identity) all fail with fetch failed after ~10s timeout. channels unresolved: guild:<id> appears in logs. DM the bot — works fine. Send a message in a guild channel — bot does not respond, no log output for the message.

Expected behavior

Expected behavior channels.discord.proxy should route all Discord traffic through the configured proxy — including WebSocket Gateway connections, REST API calls (command deployment, bot identity fetch), and guild resolution. DMs and guild channels should both work behind a proxy.

Actual behavior

Actual behavior

WebSocket Gateway connection uses the proxy → works (DMs functional) REST API calls during startup do not use the proxy → all fail with TypeError: fetch failed after ~10s Guild resolve fails silently → channels unresolved: guild:<id> All guild channel messages are silently ignored Bot appears online in guild but never responds to any guild messages

Startup log excerpt: [discord] rest proxy enabled [discord] channels unresolved: guild:<id> (guildId:<id>) [discord] startup [default] deploy-rest:put:error 11291ms error=fetch failed [discord] discord: failed to deploy native commands: fetch failed [discord] discord: failed to fetch bot identity: TypeError: fetch failed [discord] logged in to discord Verification that proxy itself works (same proxy, same machine): bashcurl -x http://127.0.0.1:7890 https://discord.com/api/v10/users/@me -H "Authorization: Bot <token>"

Returns 200 OK with bot identity JSON

Node.js built-in fetch does not support proxy: bashnode -e "fetch('https://discord.com/api/v10/users/@me').then(r=>console.log(r.status)).catch(e=>console.log(e.message))"

Output: fetch failed

Workaround with undici ProxyAgent fixes REST but not guild resolve: bashNODE_OPTIONS="--require proxy-bootstrap.js" openclaw gateway --force

proxy-bootstrap.js: setGlobalDispatcher(new ProxyAgent('http://127.0.0.1:7890'))

Result: REST calls succeed, WebSocket connects, but guild still unresolved

OpenClaw version

2026.3.13 (61d171a)

Operating system

macOS 26.3.1 (arm64, Apple Silicon Mac mini)

Install method

npm install -g openclaw@latest (via Homebrew Node.js 25.8.0)

Model

minimax-portal/MiniMax-M2.7

Provider / routing chain

MiniMax Portal (OAuth) → OpenClaw Gateway (local, ws://127.0.0.1:18789) → Discord channel (via Clash HTTP proxy at 127.0.0.1:7890)

Config file / key location

~/.openclaw/openclaw.json → channels.discord.proxy, channels.discord.guilds

Additional provider/model setup details

<h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">setup details</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Proxy combinations tested:</strong></p> <div class="overflow-x-auto w-full px-2 mb-6"> channels.discord.proxy | Global undici ProxyAgent | WebSocket | REST API | Guild Resolve -- | -- | -- | -- | -- ✅ | ❌ | ✅ | ❌ timeout | ❌ ❌ | ✅ | ❌ TLS error | ✅ | ❌ ✅ | ✅ | ✅ | ✅ | ❌ still unresolved ❌ | ❌ | ❌ | ❌ | ❌ </div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Key findings:</strong></p> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Node.js 25.8.0 built-in <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">fetch</code> (undici) does not respect <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">HTTP_PROXY</code>/<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">HTTPS_PROXY</code> env vars or system proxy settings</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> only applies to the WebSocket Gateway connection, not REST API calls</li> <li class="whitespace-normal break-words pl-2">Guild resolve appears to use a separate code path that neither <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> nor global <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">setGlobalDispatcher</code> covers</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openclaw channels resolve --channel discord --kind group &lt;guild_id&gt;</code> succeeds when run as a separate CLI command with the ProxyAgent bootstrap, confirming the guild data is accessible</li> <li class="whitespace-normal break-words pl-2">The same bot + config worked correctly on a cloud server (Tencent Cloud) with direct Discord access (no proxy needed), confirming this is proxy-specific</li> </ul> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Suggested fix:</strong> Apply <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">channels.discord.proxy</code> to the undici dispatcher for all REST API calls during Discord provider startup, not just WebSocket. Consider supporting a global proxy config (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">gateway.proxy</code> or <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">network.proxy</code>) that sets a global undici <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">ProxyAgent</code>. Ensure guild resolve uses the same proxied HTTP path and has retry logic.</p>

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

openclaw-discord-proxy-bug-report.md

extent analysis

Fix Plan

To fix the issue, we need to apply the channels.discord.proxy to the undici dispatcher for all REST API calls during Discord provider startup.

  • Set up a global proxy config, e.g., gateway.proxy or network.proxy, to set a global undici ProxyAgent.
  • Modify the Discord provider startup to use the proxied HTTP path for REST API calls.
  • Ensure guild resolve uses the same proxied HTTP path and has retry logic.

Example code snippet to set a global undici ProxyAgent:

const { ProxyAgent } = require('undici');
const proxyUrl = 'http://127.0.0.1:7890';
const proxyAgent = new ProxyAgent(proxyUrl);
setGlobalDispatcher(proxyAgent);

Modify the Discord provider startup to use the proxied HTTP path:

const fetch = require('node-fetch');
const proxyAgent = getGlobalDispatcher();
fetch('https://discord.com/api/v10/users/@me', { agent: proxyAgent })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Verification

To verify the fix, run the OpenClaw gateway with the modified Discord provider startup and check the logs for successful REST API calls and guild resolve.

  • Run openclaw gateway --force and observe the startup logs.
  • Check if the WebSocket connection and REST API calls are successful.
  • Verify if the guild channels are resolved correctly.

Extra Tips

  • Make sure to handle errors and retries properly when using the proxied HTTP path.
  • Consider adding logging and monitoring to track the performance of the proxied REST API calls.
  • If you're behind a corporate firewall, ensure that the proxy settings are correctly configured and allowed by your organization's security policies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected behavior channels.discord.proxy should route all Discord traffic through the configured proxy — including WebSocket Gateway connections, REST API calls (command deployment, bot identity fetch), and guild resolution. DMs and guild channels should both work behind a proxy.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING