Resolve unhandled promise rejection in ide-client.ts (#15587)

This commit is contained in:
Adib234
2025-12-26 11:37:13 -05:00
committed by GitHub
parent 69fc75c0b2
commit acecd80afa

View File

@@ -678,6 +678,9 @@ export class IdeClient {
noProxy: [existingNoProxy, '127.0.0.1'].filter(Boolean).join(','),
});
const undiciPromise = import('undici');
// Suppress unhandled rejection if the promise is not awaited immediately.
// If the import fails, the error will be thrown when awaiting undiciPromise below.
undiciPromise.catch(() => {});
return async (url: string | URL, init?: RequestInit): Promise<Response> => {
const { fetch: fetchFn } = await undiciPromise;
const fetchOptions: RequestInit & { dispatcher?: unknown } = {