Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 应用设置-AI服务商设置页面 无法展示,一直报错Invalid key length #5534

Closed
ladypiapia opened this issue Jan 21, 2025 · 6 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@ladypiapia
Copy link

📦 部署环境

Vercel

📌 软件版本

v1.47.12

💻 系统环境

Other Linux

🌐 浏览器

Chrome

🐛 问题描述

配置AI服务商时,页面无法加载,一直提示很抱歉,服务器似乎遇到了一些困难,暂时无法完成您的请求,请稍后再试,如下图

Image

[
    {
        "error": {
            "json": {
                "message": "Invalid key length",
                "code": -32603,
                "data": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "httpStatus": 500,
                    "path": "aiProvider.getAiProviderList"
                }
            }
        }
    }
]

📷 复现步骤

更新到了最新的v1.47.12,但配置AI服务商时页面无法加载,提示如上报错

🚦 期望结果

如何定位和解决这个问题呢

📝 补充信息

暂无

@ladypiapia ladypiapia added the 🐛 Bug Something isn't working | 缺陷 label Jan 21, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Jan 21, 2025
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Vercel

📌 Software version

v1.47.12

💻 System environment

Other Linux

🌐 Browser

Chrome

🐛 Problem description

When configuring the AI ​​service provider, the page cannot be loaded and it keeps prompting ```Sorry, the server seems to have encountered some difficulties and is temporarily unable to complete your request. Please try again later``, as shown below

Image

[
    {
        "error": {
            "json": {
                "message": "Invalid key length",
                "code": -32603,
                "data": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "httpStatus": 500,
                    "path": "aiProvider.getAiProviderList"
                }
            }
        }
    }
]

📷 Steps to reproduce

Updated to the latest v1.47.12, but when configuring the AI ​​service provider, the page cannot be loaded and the error message is as above.

🚦 Expected results

How to locate and solve this problem?

📝 Supplementary information

None

@lobehubbot
Copy link
Member

👀 @ladypiapia

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Jan 21, 2025

Hello, @ladypiapia! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're experiencing.

The error message "Invalid key length" suggests that there might be an issue with the configuration of the AI service provider keys. This error is occurring when trying to access the aiProvider.getAiProviderList endpoint, which is likely related to the validation of the keys used for AI service providers.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check Key Configuration: Ensure that the keys for the AI service providers are correctly configured in the application settings. Verify that they meet the expected format and length requirements, although specific details about these requirements are not available in the current context.

  2. Review Recent Changes: According to recent updates, there was a fix for a bug that caused API keys to be incorrectly reported as invalid for multiple providers. Ensure that your configuration aligns with these updates, especially if you are using providers like Azure [1].

  3. Inspect Server Logs: Check the server logs for more detailed error messages that might provide additional context about the "Invalid key length" error. This can help identify if the issue is with a specific provider or a general configuration problem.

  4. Update to Latest Version: If you haven't already, ensure that you are using the latest version of the application, as updates might contain fixes for known issues.

If these steps do not resolve the issue, further investigation into the specific implementation of key validation in the codebase might be necessary.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@ladypiapia
Copy link
Author

#5446
原因在于KEY_VAULTS_SECRET 环境变量。该变量用于加密用户存储的 apikey 等敏感信息。可以使用 openssl rand -base64 32 生成一个随机的 32 位字符串作为密钥。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


#5446
The reason lies in the KEY_VAULTS_SECRET environment variable. This variable is used to encrypt sensitive information such as apikey stored by the user. You can use openssl rand -base64 32 to generate a random 32-bit string as a key.

@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Jan 21, 2025
@lobehubbot
Copy link
Member

@ladypiapia

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Done
Development

No branches or pull requests

2 participants