Skip to content

Commit

Permalink
fix: handle process.env being undefined in debug func (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Mar 21, 2024
1 parent a06d861 commit 2baa149
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 2baa149

Please sign in to comment.