From c8c69a0b1e44910cf31b93bbf4d2201df8f7e921 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 21 Mar 2024 15:55:06 +0000 Subject: [PATCH] fix: handle process.env being undefined in debug func --- src/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index a94251808..4364c7a3c 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1075,7 +1075,7 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { } export function debug(action: string, ...args: any[]) { - if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') { + if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { console.log(`OpenAI:DEBUG:${action}`, ...args); } }