openclaw - 💡(How to fix) Fix Discord can log in behind proxy, but native command deploy / bot identity fetch fail with 'fetch failed' [2 comments, 1 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#51018Fetched 2026-04-08 01:05:30
View on GitHub
Comments
2
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
commented ×2subscribed ×1

When Discord is configured behind an HTTP proxy, OpenClaw can partially start the Discord provider and log in successfully, but some startup REST calls still fail with fetch failed.

In my setup, the gateway is healthy and Discord shows logged in to discord, but these startup steps consistently fail:

  • native command deployment
  • bot identity fetch

This makes the Discord provider look half-working: login/WebSocket path appears alive, while some REST requests fail.

Error Message

Across repeated restarts / health-monitor restarts, the pattern is stable:

Root Cause

Why this looks like an OpenClaw bug

This does not look like a simple token/configuration error because:

  • the gateway is healthy
  • Discord channel/guild resolution succeeds
  • application ID fetch succeeds
  • the provider still logs in to Discord
  • only some REST startup calls fail

Fix Action

Fix / Workaround

Suspected root cause

Possibly one of these:

  • some Discord REST requests are not using the same proxy-aware fetch/dispatcher path as the gateway/login path
  • proxy handling is partially applied (some requests proxied, some direct)
  • startup REST calls and login/WebSocket path use different transport code paths

If helpful, I can provide more environment details or help test a patch.

Code Example

[discord] rest proxy enabled
[discord] fetch-application-id:done
[discord] gateway proxy enabled
[discord] deploy-rest:put:error ... error=fetch failed
[discord] failed to deploy native commands: fetch failed
[discord] failed to fetch bot identity: TypeError: fetch failed
[discord] logged in to discord

---

[health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)

---

2026-03-20T17:34:25.535+08:00 [discord] rest proxy enabled
2026-03-20T17:34:31.201+08:00 [discord] startup [default] fetch-application-id:done 5687ms applicationId=1483102717173039197 gateway=missing
2026-03-20T17:34:31.614+08:00 [discord] gateway proxy enabled
2026-03-20T17:34:31.624+08:00 [discord] startup [default] deploy-rest:put:start 6109ms path=/applications/1483102717173039197/commands commands=60 bytes=18794
2026-03-20T17:34:31.882+08:00 [discord] startup [default] deploy-rest:put:error 6366ms path=/applications/1483102717173039197/commands requestMs=257 error=fetch failed
2026-03-20T17:34:31.886+08:00 [discord] failed to deploy native commands: fetch failed
2026-03-20T17:34:31.891+08:00 [discord] startup [default] fetch-bot-identity:start 6377ms gatewayConnected=false reconnectAttempts=0
2026-03-20T17:34:32.147+08:00 [discord] failed to fetch bot identity: TypeError: fetch failed
2026-03-20T17:34:32.164+08:00 [discord] logged in to discord
RAW_BUFFERClick to expand / collapse

Summary

When Discord is configured behind an HTTP proxy, OpenClaw can partially start the Discord provider and log in successfully, but some startup REST calls still fail with fetch failed.

In my setup, the gateway is healthy and Discord shows logged in to discord, but these startup steps consistently fail:

  • native command deployment
  • bot identity fetch

This makes the Discord provider look half-working: login/WebSocket path appears alive, while some REST requests fail.

Environment

  • OpenClaw version: 2026.3.12 service / config touched by 2026.3.13
  • OS: Ubuntu 24.04
  • Runtime: systemd user service
  • Proxy configured for Discord: channels.discord.proxy = http://127.0.0.1:8119
  • Gateway service also runs with proxy environment enabled

Observed behavior

Across repeated restarts / health-monitor restarts, the pattern is stable:

[discord] rest proxy enabled
[discord] fetch-application-id:done
[discord] gateway proxy enabled
[discord] deploy-rest:put:error ... error=fetch failed
[discord] failed to deploy native commands: fetch failed
[discord] failed to fetch bot identity: TypeError: fetch failed
[discord] logged in to discord

There are also periodic stale socket restarts afterward:

[health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)

Relevant logs

Example startup sequence:

2026-03-20T17:34:25.535+08:00 [discord] rest proxy enabled
2026-03-20T17:34:31.201+08:00 [discord] startup [default] fetch-application-id:done 5687ms applicationId=1483102717173039197 gateway=missing
2026-03-20T17:34:31.614+08:00 [discord] gateway proxy enabled
2026-03-20T17:34:31.624+08:00 [discord] startup [default] deploy-rest:put:start 6109ms path=/applications/1483102717173039197/commands commands=60 bytes=18794
2026-03-20T17:34:31.882+08:00 [discord] startup [default] deploy-rest:put:error 6366ms path=/applications/1483102717173039197/commands requestMs=257 error=fetch failed
2026-03-20T17:34:31.886+08:00 [discord] failed to deploy native commands: fetch failed
2026-03-20T17:34:31.891+08:00 [discord] startup [default] fetch-bot-identity:start 6377ms gatewayConnected=false reconnectAttempts=0
2026-03-20T17:34:32.147+08:00 [discord] failed to fetch bot identity: TypeError: fetch failed
2026-03-20T17:34:32.164+08:00 [discord] logged in to discord

The same failure pattern repeats on later health-monitor restarts at 18:09, 18:44, and 19:19.

Why this looks like an OpenClaw bug

This does not look like a simple token/configuration error because:

  • the gateway is healthy
  • Discord channel/guild resolution succeeds
  • application ID fetch succeeds
  • the provider still logs in to Discord
  • only some REST startup calls fail

That suggests different Discord request paths may not be using proxy behavior consistently.

Suspected root cause

Possibly one of these:

  • some Discord REST requests are not using the same proxy-aware fetch/dispatcher path as the gateway/login path
  • proxy handling is partially applied (some requests proxied, some direct)
  • startup REST calls and login/WebSocket path use different transport code paths

Reproduction notes

My Discord configuration includes an explicit proxy and the issue is reproducible across repeated provider restarts.

If helpful, I can provide more environment details or help test a patch.

extent analysis

Fix Plan

To resolve the issue of some Discord REST requests failing when behind an HTTP proxy, we need to ensure that all requests use the proxy-aware fetch/dispatcher path.

Here are the steps to fix the issue:

  • Update the discord provider configuration to use a proxy for all REST requests.
  • Modify the fetch function to use the proxy for all requests.

Example code snippet:

// Update the discord provider configuration
const discordConfig = {
  // ... other config options ...
  proxy: 'http://127.0.0.1:8119',
  restProxy: 'http://127.0.0.1:8119' // Add this line
};

// Modify the fetch function to use the proxy
const fetch = (url, options) => {
  if (discordConfig.restProxy) {
    options.proxy = discordConfig.restProxy;
  }
  // ... rest of the fetch function implementation ...
};

Alternatively, you can use a library like fetch-proxy to handle proxying for you:

const fetchProxy = require('fetch-proxy');

const fetch = fetchProxy('http://127.0.0.1:8119');

Verification

To verify that the fix worked, restart the Discord provider and check the logs for any errors. The deploy-rest:put:error and failed to fetch bot identity errors should be resolved.

You can also test the fix by making a REST request to the Discord API using the updated fetch function:

fetch('https://discord.com/api/v9/users/@me', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));

If the request is successful, the fix has worked.

Extra Tips

  • Make sure to update the discord provider configuration to use the correct proxy URL.
  • If you are using a self-signed certificate for your proxy, you may need to add the rejectUnauthorized: false option to the fetch function to avoid certificate errors.
  • Consider using a library like fetch-proxy to handle proxying for you, as it can simplify the process and reduce the risk of errors.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING