diff --git a/src/core.ts b/src/core.ts index 7b5a97bb..dfe9bd5b 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(`Anthropic:DEBUG:${action}`, ...args); } }