Skip to content

Whisper model download fails when HTTP proxy is needed (Node.js https.get ignores HTTP_PROXY) #704

Description

@baoyu0

Bug Description

Clicking "Download Model" in the subtitle/auto-captions editor always fails. The download never completes — no error is shown in the UI other than a generic failure, and the whisper/ directory remains empty.

Root Cause

Recordly's Electron main process downloads the Whisper model using Node.js built-in require("node:https").get() (aliased as mv in dist-electron/main.cjs, line 2).

Node.js's native https.get() does not support HTTP_PROXY/HTTPS_PROXY environment variables. It always makes direct TCP connections to the target host.

The download URL is:

https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin

On networks where HuggingFace is blocked or only reachable through an HTTP proxy (e.g. behind a firewall, corporate proxy, or in regions with internet restrictions like China), https.get() fails with ETIMEDOUT because the proxy is never used.

Verification

# curl respects HTTP_PROXY -> works
curl -L "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin"
302 Found -> downloads 465 MB ggml-small.bin

# Node.js https.get ignores HTTP_PROXY -> times out
node -e "require(\"https\").get(\"...\", {timeout:15000}, ...)"
AggregateError: ETIMEDOUT

Affected Code

dist-electron/main.cjs:

// Line 2: mv = require("node:https")
// The download function gE() uses mv.get():
function gE(e,t,r){
  const n=(i,a=0)=>new Promise((s,o)=>{
    const c=mv.get(i, {timeout:3e4}, u=>{ ... });
  });
}

Node.js's built-in HTTP/HTTPS modules (node:http, node:https) do not natively support HTTP proxies. This is a well-known limitation. The HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables that tools like curl and many package managers respect are simply not checked by these modules.

Steps to Reproduce

  1. Install Recordly on a machine that can only reach HuggingFace through an HTTP proxy
  2. Set HTTP_PROXY=http://proxy:port and HTTPS_PROXY=http://proxy:port environment variables
  3. Open the editor -> subtitles -> click "Download Model"
  4. The download fails silently (ETIMEDOUT)

Expected Behavior

The download should work regardless of whether the user needs an HTTP proxy to reach HuggingFace. Recordly should either:

  1. Use an HTTP client that supports proxy environment variables (e.g. undici with proxy dispatcher, or the https-proxy-agent package)
  2. Or pass the proxy settings explicitly via Node.js http.Agent / https.Agent

Environment

  • OS: Windows 10
  • Recordly version: 1.3.3
  • Network: Behind HTTP proxy (Karing 127.0.0.1:3067)

Suggested Fix

Replace the bare https.get() call with a proxy-aware approach. The simplest fix would be to use undici (built-in since Node.js 20) with a proxy dispatcher, or to create an https.Agent that uses the https-proxy-agent package when HTTP_PROXY/HTTPS_PROXY env vars are set.

Example with https-proxy-agent:

const HttpsProxyAgent = require("https-proxy-agent");
const https = require("https");

function getWithProxy(url, options) {
  const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
  const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
  return https.get(url, { ...options, agent });
}

Workaround

Manually download the model with curl (which respects HTTP_PROXY) and place it at the correct path:

curl -L -o "$APPDATA/Recordly/whisper/ggml-small.bin" \
  "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin"

After placing the file there, the "Download Model" button immediately detects it as already downloaded (via the get-whisper-small-model-status IPC handler checking file existence).

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