Skip to content

Slack Socket Mode WebSocket connections don't honor HTTPS_PROXY #57405

@mjamiv

Description

@mjamiv

Problem

When running OpenClaw inside a proxy-only network environment (e.g., NVIDIA OpenShell sandboxes), Slack Socket Mode WebSocket connections fail because the ws library does not natively honor the HTTPS_PROXY / HTTP_PROXY environment variables.

All outbound traffic in these environments must route through an HTTP CONNECT proxy. REST API calls work correctly because undici's EnvHttpProxyAgent respects proxy env vars. However, WebSocket connections to wss-primary.slack.com and wss-backup.slack.com bypass the proxy entirely and fail.

Additionally, Slack file downloads via Node's native https module (files.slack.com) also do not honor proxy env vars, so those fail as well.

Current Workaround

We wrote a NODE_OPTIONS=--require preload script that monkey-patches:

  1. The ws WebSocket constructor — intercepts new WebSocket(url, ...) calls targeting Slack WebSocket hosts, injects a custom https.Agent (via the https-proxy-agent package) that tunnels through the CONNECT proxy.
  2. Node's https.request / https.get — intercepts calls to files.slack.com and similarly injects a proxy-aware agent.

This works but is fragile, version-sensitive, and shouldn't be necessary.

Suggested Fix

When HTTPS_PROXY (or HTTP_PROXY / ALL_PROXY) is set, OpenClaw should pass a proxy-aware agent to the ws WebSocket constructor for Slack Socket Mode connections. For example, using https-proxy-agent or hpagent:

const { HttpsProxyAgent } = require('https-proxy-agent');
const proxyAgent = new HttpsProxyAgent(process.env.HTTPS_PROXY);
const ws = new WebSocket(slackWssUrl, { agent: proxyAgent });

The same approach should apply to any https.request / https.get calls for Slack file downloads — pass the proxy agent via the agent option.

This would bring WebSocket and file-download behavior in line with how undici already handles REST calls via EnvHttpProxyAgent.

Environment

  • OpenClaw version: 2026.3.28
  • Node.js version: 22.22.1
  • Runtime: NVIDIA OpenShell v0.0.16 sandbox (Linux, isolated network namespace)
  • Proxy: HTTP CONNECT proxy at local bridge interface, no direct internet access
  • Slack integration: Socket Mode enabled

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions