diff --git a/open-sse/utils/proxyFetch.ts b/open-sse/utils/proxyFetch.ts index c439cb4fb9..dd56e5f0ee 100644 --- a/open-sse/utils/proxyFetch.ts +++ b/open-sse/utils/proxyFetch.ts @@ -1,4 +1,5 @@ import { AsyncLocalStorage } from "node:async_hooks"; +import { fetch as undiciFetch } from "undici"; import { createProxyDispatcher, getDefaultDispatcher, @@ -164,7 +165,7 @@ export async function runWithProxyContext(proxyConfig, fn) { async function patchedFetch(input: RequestInfo | URL, options: FetchWithDispatcherOptions = {}) { if (options?.dispatcher) { - return originalFetchWithDispatcher(input, options); + return (undiciFetch as any)(input, options); } const targetUrl = getTargetUrl(input); @@ -197,7 +198,7 @@ async function patchedFetch(input: RequestInfo | URL, options: FetchWithDispatch if (store) store.used = false; } } - return originalFetchWithDispatcher(input, { + return (undiciFetch as any)(input, { ...options, dispatcher: getDefaultDispatcher(), }); @@ -205,7 +206,7 @@ async function patchedFetch(input: RequestInfo | URL, options: FetchWithDispatch try { const dispatcher = createProxyDispatcher(proxyUrl); - return await originalFetchWithDispatcher(input, { ...options, dispatcher }); + return await (undiciFetch as any)(input, { ...options, dispatcher }); } catch (error) { const message = error instanceof Error ? error.message : String(error); console.error(`[ProxyFetch] Proxy request failed (${source}, fail-closed): ${message}`); diff --git a/tests/unit/login-bootstrap-route.test.mjs b/tests/unit/login-bootstrap-route.test.mjs index 05c74fb30b..64c376cc94 100644 --- a/tests/unit/login-bootstrap-route.test.mjs +++ b/tests/unit/login-bootstrap-route.test.mjs @@ -49,6 +49,8 @@ test("public login bootstrap route exposes the metadata the login page consumes" requireLogin: true, hasPassword: false, setupComplete: true, + nodeVersion: body.nodeVersion, + nodeCompatible: body.nodeCompatible, }); }); @@ -68,6 +70,8 @@ test("public login bootstrap route reports env-provided bootstrap password metad requireLogin: true, hasPassword: true, setupComplete: true, + nodeVersion: body.nodeVersion, + nodeCompatible: body.nodeCompatible, }); }); @@ -86,6 +90,8 @@ test("public login bootstrap route reports stored password metadata and disabled requireLogin: false, hasPassword: true, setupComplete: true, + nodeVersion: body.nodeVersion, + nodeCompatible: body.nodeCompatible, }); });