Skip to content

Commit 22b850a

Browse files
jordanhunt22Convex, Inc.
authored andcommitted
Respect proxy from environment (#41240)
We previously weren't respecting the http proxy from the environment. This was causing cloud coding tools like Codex to fail because they proxy all requests. Tested this to confirm it works properly. GitOrigin-RevId: 0e09823f5b5102a0c25a8d5c892104de53cbf68c
1 parent cd54ce3 commit 22b850a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@
338338
"typescript": "~5.0.3",
339339
"typescript-eslint": "~8.38.0",
340340
"vitest": "^3.2.4",
341+
"undici": "7.11.0",
341342
"wait-for-expect": "~4.0.0",
342343
"ws": "8.18.0",
343344
"zod": "^3.24.0",

src/cli/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { mcp } from "./mcp.js";
3232
import dns from "node:dns";
3333
import net from "node:net";
3434
import { integration } from "./integration.js";
35+
import { setGlobalDispatcher, ProxyAgent } from "undici";
36+
import { logVerbose } from "../bundler/log.js";
3537

3638
const MINIMUM_MAJOR_VERSION = 16;
3739
const MINIMUM_MINOR_VERSION = 15;
@@ -46,6 +48,12 @@ async function main() {
4648
const majorVersion = parseInt(nodeVersion.split(".")[0], 10);
4749
const minorVersion = parseInt(nodeVersion.split(".")[1], 10);
4850

51+
const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
52+
if (proxy) {
53+
setGlobalDispatcher(new ProxyAgent(proxy));
54+
logVerbose(`[proxy-bootstrap] Using proxy: ${proxy}`);
55+
}
56+
4957
// Use ipv4 first for 127.0.0.1 in tests
5058
dns.setDefaultResultOrder("ipv4first");
5159

0 commit comments

Comments
 (0)