-
Notifications
You must be signed in to change notification settings - Fork 715
Description
Description
opencli does not honor http_proxy / https_proxy for Node-side fetch requests, so commands that require the configured proxy fail with TypeError: fetch failed even though the same URLs work with curl in the same environment.
Steps to Reproduce
Steps to reproduce
- Run export http_proxy=http://127.0.0.1:7897 && export https_proxy=http://127.0.0.1:7897
- Run opencli v2ex latest -f json
- See error
Actual behavior
opencli fails with a Node fetch error on sites that require the configured proxy:
TypeError: fetch failed
at node:internal/deps/undici/undici:15482:13
...
[cause]: AggregateError [ETIMEDOUT]
In my case, opencli v2ex hot --verbose also failed earlier with the same Node-side fetch failed stack.
Expected behavior
opencli should honor http_proxy / https_proxy automatically, the same way curl does, and successfully return V2EX results.
Environment
- opencli: 1.5.0
- Node: 24.2.0
- OS: macOS
- Proxy env:
- http_proxy=http://127.0.0.1:7897
- https_proxy=http://127.0.0.1:7897
Additional context
This does not affect every command. For example, opencli apple-podcasts top works fine in the same shell, which suggests the bug only shows up for endpoints that need the configured proxy to be reachable.
Also, plain curl to V2EX works in the same environment, so the issue seems specific to Node-side fetch not using the proxy env vars by default.
Workaround
Running with NODE_USE_ENV_PROXY=1 makes the same request succeed:
NODE_USE_ENV_PROXY=1 opencli v2ex latest -f json
Expected Behavior
opencli should automatically use the configured proxy environment variables for Node-side network requests and return command results successfully instead of timing out with fetch failed.
OpenCLI Version
1.5.0
Node.js Version
Other
Operating System
macOS