From 58cde874365d6104a3b5a41f997774432cda207a Mon Sep 17 00:00:00 2001 From: Marcus Castro Date: Sun, 1 Mar 2026 20:43:15 -0300 Subject: [PATCH] fix: warn when proxy env var is set but agent creation fails --- src/infra/net/proxy-fetch.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/infra/net/proxy-fetch.ts b/src/infra/net/proxy-fetch.ts index 44738bd2e39..e6c11813959 100644 --- a/src/infra/net/proxy-fetch.ts +++ b/src/infra/net/proxy-fetch.ts @@ -1,4 +1,5 @@ import { EnvHttpProxyAgent, ProxyAgent, fetch as undiciFetch } from "undici"; +import { logWarn } from "../../logger.js"; /** * Create a fetch function that routes requests through the given HTTP proxy. @@ -38,8 +39,10 @@ export function resolveProxyFetchFromEnv(): typeof fetch | undefined { ...(init as Record), dispatcher: agent, }) as unknown as Promise) as typeof fetch; - } catch { - // Malformed proxy URL in env — fall back to direct fetch. + } catch (err) { + logWarn( + `Proxy env var set but agent creation failed — falling back to direct fetch: ${err instanceof Error ? err.message : String(err)}`, + ); return undefined; } }