dexaai/openai-fetch

Uncaught (in promise) ReferenceError: process is not defined

Closed this issue · 0 comments

Hi, first of all, thanks for great lib

These lines would cause an error in environments where process is not available (ex. Cloudflare or browsers) in case if apiKey or organizationId is not specified

Error I get when trying to run in Cloudflare worker

✘ [ERROR] Uncaught (in promise) ReferenceError: process is not defined

  const organizationId = opts.organizationId || process.env.OPENAI_ORG_ID;
                                                ^
      at OpenAIClient
  (/root/dev/app/node_modules/openai-fetch/src/openai-client.ts:62:50)
      at fetch (/root/dev/app/src/worker.ts:32:17)

As lib claims it supports all environments, including browsers, process should not be used as fallback