fix: NVIDIA NIM API key validation timeout (bypass proxy fetch patch) (#3226)

NVIDIA NIM validation bypasses the proxy-patched fetch (504 fix) + combined with #3116 reliable probe model + test. Integrated into release/v3.8.11.
This commit is contained in:
MeAdityaB
2026-06-05 20:22:27 +05:30
committed by GitHub
parent dfcaeba6d9
commit 4dbbbaacf1
5 changed files with 119 additions and 9 deletions

View File

@@ -13,10 +13,13 @@ const FETCH_TIMEOUT_MS = parseInt(process.env.FETCH_TIMEOUT_MS || "", 10) || DEF
interface FetchTimeoutOptions extends RequestInit {
timeoutMs?: number;
/** Alternative fetch function to use instead of globalThis.fetch.
* Pass getOriginalFetch() to bypass the proxy/TLS patch layer. */
fetchFn?: typeof globalThis.fetch;
}
export async function fetchWithTimeout(url: string | URL, options: FetchTimeoutOptions = {}) {
const { timeoutMs = FETCH_TIMEOUT_MS, signal: externalSignal, ...fetchOptions } = options;
const { timeoutMs = FETCH_TIMEOUT_MS, signal: externalSignal, fetchFn, ...fetchOptions } = options;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
@@ -31,7 +34,8 @@ export async function fetchWithTimeout(url: string | URL, options: FetchTimeoutO
}
try {
const response = await fetch(url, {
const doFetch = fetchFn || globalThis.fetch;
const response = await doFetch(url, {
...fetchOptions,
signal: controller.signal,
});