- Issue created by @arialblack
- Status changed to Needs work
5 months ago 3:10pm 2 August 2024 - ๐ฌ๐งUnited Kingdom scott_euser
Thanks for flagging the issue. Few things here:
- Can you say the length of your key? Text area probably not right, probably should be a text field still with a higher #size
- Please create as a merge request for easier review and merge
- If storage size in database table needs to change, needs update hook otherwise existing sites will have entity definition warnings in admin status report. Something like this https://agaric.coop/blog/change-text-field-maximum-length-drupal-8
.
- ๐ฏ๐ดJordan rahaf albawab Amman
Rahaf Albawab โ made their first commit to this issueโs fork.
- Merge request !98Draft: Resolve #3465426 "Increase api key length" โ (Open) created by rahaf albawab
- ๐ฏ๐ดJordan rahaf albawab Amman
Hi @scott_euser.
I'm facing the same issue, and my key length is also 132. I created a merge request; you can check it. - ๐ฎ๐ณIndia Pinesh Kumar
Instead of increasing the maxlength for the API key field, I recommend using the Key module for securely storing API keys. This allows flexibility and better security without worrying about arbitrary field length limits.
if (\Drupal::moduleHandler()->moduleExists('key')) { $key = \Drupal\key\Entity\Key::load('openai_api_key'); $api_key = $key ? $key->getKeyValue() : ''; } else { $api_key = $this->config('openai.settings')->get('api_key'); }
- ๐ฌ๐งUnited Kingdom scott_euser
Yep that's how we are doing it in the ai module which is slowly taking this over. https://www.drupal.org/project/ai โ
- ๐น๐ญThailand AlfTheCat
Hope I'm not overstepping my boundaries here but I think a bump in priority is called for. This module is now not available to new projects or projects using a newer api key.
I've got one old key in my possession that's now in use on a handful of sites and that is not ideal, but for those without access to older keys this module is unusable at the moment.
Migrating to the new ai module is definitely the way to go in general but it's going to take a lot of time in many cases so we don't have a viable work around right now leaving some people in the dust.
- ๐บ๐ธUnited States shasha821110
same issue here. Newer API Key seems make error and all the function not working in openAI module.
- ๐ง๐ชBelgium stijnstroobants Leuven
Had the same issue, my API-key had 163 characters. Forcing the field to allow 255 characters fixed the issue in my case.
Patch attached. - ๐ฌ๐งUnited Kingdom ujdave
Had the same issue, but our key was even longer and we use they key module anyway, so on top of increasing the field size to 256 I added a bit more logic to cover the use case for they key module as well.
Patch attached. - Merge request !99Issue #3465426 by ujdave: Add key module compatibility โ (Open) created by ujdave
- Status changed to Needs review
about 1 month ago 2:33am 18 November 2024 - ๐น๐ผTaiwan charlesc
same issue here.
New/long API Key made error so the OpenAI module cant work as usually - ๐ฒ๐พMalaysia ckng
Patch #13 works for us.
Patch #15 using deprecated API and breaks the /admin/config/openai/chatgpt page. mariab โ changed the visibility of the branch bugfix/3465426-increase-maxlength to hidden.
Patch #15 is a new feature and provides extra functionality which is out of scope. So, I opened a new issue for this.
https://www.drupal.org/project/openai/issues/3493573#comment-15899026 โจ Integration with key module Active- ๐ฌ๐ทGreece vensires
I can't turn https://git.drupalcode.org/project/openai/-/merge_requests/98 to "ready" state but it does what it promises, related to the specific issue description. I set it as RTBC.