miurla/morphic

[BUG] Missing Validation for azureApiKey in lib/utils/index.ts

diogo-karma opened this issue · 0 comments

Is there an existing issue for this?

  • I have searched the existing issues

Vercel Runtime Logs

  • I have checked the Vercel Runtime Logs for errors (if applicable)

Current Behavior

The file lib/utils/index.ts fails to validate the azureApiKey variable from the .env file. This issue causes errors when the azureApiKey is the only key present. The validation logic needs to be updated to include azureApiKey along with the other keys.

if (
    !(ollamaBaseUrl && ollamaModel) &&
    !openaiApiKey &&
    !googleApiKey &&
    !anthropicApiKey
  ) {
    throw new Error(
      'Missing environment variables for Ollama, OpenAI, Azure OpenAI, Google or Anthropic'
    )
  }

Expected Behavior

if (
    !(ollamaBaseUrl && ollamaModel) &&
    !openaiApiKey &&
    !googleApiKey &&
    !azureApiKey &&
    !anthropicApiKey
  ) {
    throw new Error(
      'Missing environment variables for Ollama, OpenAI, Azure OpenAI, Google or Anthropic'
    )
  }

Steps To Reproduce

'Missing environment variables for Ollama, OpenAI, Azure OpenAI, Google or Anthropic'

Environment

Linux kpax 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
&
Vercel

Anything else?

No response