From cc92699ff722e957ac37227be507f071af983758 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 24 Apr 2026 08:44:29 +0100 Subject: [PATCH] fix: guard openai tts fetch --- extensions/openai/tts.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/openai/tts.ts b/extensions/openai/tts.ts index 3831e781669..53f4262b909 100644 --- a/extensions/openai/tts.ts +++ b/extensions/openai/tts.ts @@ -108,6 +108,10 @@ export async function openaiTTS(params: { ...(effectiveInstructions != null && { instructions: effectiveInstructions }), }); const requestUrl = `${baseUrl}/audio/speech`; + const isGlobalFetchPatchInstalled = isDebugProxyGlobalFetchPatchInstalled(); + const guardedFetchImpl = isGlobalFetchPatchInstalled + ? globalThis.fetch.bind(globalThis) + : undefined; const { response, release } = await fetchWithSsrFGuard({ url: requestUrl, init: { @@ -116,10 +120,12 @@ export async function openaiTTS(params: { body: requestBody, signal: controller.signal, }, + ...(guardedFetchImpl ? { fetchImpl: guardedFetchImpl } : {}), + capture: false, auditContext: "openai-tts", }); try { - if (!isDebugProxyGlobalFetchPatchInstalled()) { + if (!isGlobalFetchPatchInstalled) { captureHttpExchange({ url: requestUrl, method: "POST",