From a4db5a9011f8679247c53f2a15a97af0916ce443 Mon Sep 17 00:00:00 2001 From: Richard C Lim <61879224+richardclim@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:35:32 -0500 Subject: [PATCH] Update common.ts debug logger --- app/api/common.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/api/common.ts b/app/api/common.ts index 2ec683f7b..ceae281bb 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -26,7 +26,21 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se authValue = req.headers.get("Authorization") ?? ""; authHeaderName = "Authorization"; } + +// Add debug logs +console.log("[Auth Header Name]", authHeaderName); +console.log("[Auth Value Present]", !!authValue); +const fetchOptions: RequestInit = { + headers: { + "Content-Type": "application/json", + "Cache-Control": "no-store", + [authHeaderName]: authValue, // Make sure this is being set + ...(serverConfig.openaiOrgId && { + "OpenAI-Organization": serverConfig.openaiOrgId, + }), + }, + let path = `${req.nextUrl.pathname}`.replaceAll("/api/openai/", ""); let baseUrl = (isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL; @@ -198,3 +212,4 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se clearTimeout(timeoutId); } } +console.log("[Request Headers]", fetchOptions.headers);