Error handling of missing environment variables

Created on 12 August 2024, about 1 month ago
Updated 12 September 2024, 9 days ago

Problem/Motivation

I was testing DDEV for local development and managed to break the environment variables which caused the AI module to give errors in some configuration pages:
TypeError: Drupal\provider_openai\Plugin\AiProvider\OpenAiProvider::loadApiKey(): Return value must be of type string, null returned in Drupal\provider_openai\Plugin\AiProvider\OpenAiProvider->loadApiKey() (line 247 of /var/www/html/web/modules/contrib/ai/modules/providers/provider_openai/src/Plugin/AiProvider/OpenAiProvider.php).

Steps to reproduce

Delete environment variables in your local and try to configure something.

Proposed resolution

It would be good to handle the missing variable errors rather than let the site crash.

Remaining tasks

Add error handling.

✨ Feature request
Status

Fixed

Version

1.0

Component

AI Core module

Created by

🇫🇮Finland mErilainen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024