lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.37k stars 9.94k forks source link

[Bug] v1.1.11 Azure Error #3037

Closed htdohk closed 4 months ago

htdohk commented 4 months ago

📦 部署环境

Vercel

📌 软件版本

v1.1.11

💻 系统环境

macOS

🌐 浏览器

Chrome

🐛 问题描述

这个提交之后,Azure崩了。Vercel回滚到上个部署是OK的。

截屏2024-06-25 20 56 31

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

lobehubbot commented 4 months ago

👀 @htdohk

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

bt-nia commented 4 months ago

Same here (Linux deployment in GCP though), do you have a working version before that @htdohk ?

Edit: lobehub/lobe-chat:v1.1.10 seems to not have this issue

htdohk commented 4 months ago

1.1.10 works fine~

BrandonStudio commented 4 months ago

这个报错信息的endpoint为啥没被变成星号?

lobehubbot commented 4 months ago

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


Why is the endpoint of this error message not turned into an asterisk?

JillVernus commented 4 months ago

same here, have to rollback to v1.1.10, (Docker)

htdohk commented 4 months ago

v1.1.12 fixed the Azure Plugin response issue but kept Azure response issue T_T

arvinxx commented 4 months ago

@htdohk 我本地测试是正常的,怎么复现?

lobehubbot commented 4 months ago

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


@htdohk My local test is normal, how can I reproduce it?

htdohk commented 4 months ago

其实不用任何特殊复现步骤,相同的Vercel环境配置,v1.1.10是好的,11和刚刚的12都是如上的报错。清空网站数据、输入一句“你好”就直接报错了。需要我如何提供更多信息可以再告知我~

lobehubbot commented 4 months ago

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


In fact, there is no need for any special reproduction steps. The same Vercel environment configuration, v1.1.10 is fine, and 11 and 12 just now are reporting the same error. If you need me to provide more information, please let me know~

WeihanLi commented 4 months ago

v1.1.12 版本也有这个问题

lobehubbot commented 4 months ago

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


v1.1.12 version also has this problem

breakstring commented 4 months ago

v1.1.12 版本也有这个问题

+1

lobehubbot commented 4 months ago

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


v1.1.12 version also has this problem

+1

htdohk commented 4 months ago

@arvinxx v1.1.11、12、13问题依旧。无需复现路径,就是任何发送都是回复这个报错。烦请优先解决不然完全无法使用了。

lobehubbot commented 4 months ago

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


@arvinxx The problem remains with v1.1.11, 12, and 13. There is no need to reproduce the path, just any sending will reply to this error. Please resolve it first, otherwise it will be completely unusable.

BrandonStudio commented 4 months ago

测试了一下,在Vercel和Docker,服务器请求都会出错 image image

客户端请求没问题

lobehubbot commented 4 months ago

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


After testing it, in Vercel and Docker, server requests will go wrong. No problem with client request

arvinxx commented 4 months ago

搜了下 userAgentData 在代码里并不存在,感觉像是依赖问题

lobehubbot commented 4 months ago

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


After searching, userAgentData does not exist in the code. It feels like a dependency issue.

BrandonStudio commented 4 months ago
Route: [azure] AgentRuntimeError: {
  cause: undefined,
  message: 'Cannot read properties of undefined (reading \'userAgentData\')',
  name: 'TypeError'
}
 POST /api/chat/azure 470 in 6197ms
TypeError: Cannot read properties of undefined (reading 'userAgentData')
    at setPlatformSpecificData (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/OpenAIClient.js:79:83)
    at new LobeAzureOpenAI (webpack-internal:///(rsc)/./src/libs/agent-runtime/azureOpenai/index.ts:52:23)
 ⨯ unhandledRejection: TypeError: Cannot read properties of undefined (reading 'userAgentData')
    at setPlatformSpecificData (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/OpenAIClient.js:79:83)
    at new LobeAzureOpenAI (webpack-internal:///(rsc)/./src/libs/agent-runtime/azureOpenai/index.ts:52:23)
 ⨯ unhandledRejection: TypeError: Cannot read properties of undefined (reading 'userAgentData')
    at setPlatformSpecificData (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+core-rest-pipeline@1.16.1/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure-rest+core-client@1.4.0/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@azure+openai@1.0.0-beta.12/node_modules/@azure/openai/dist-esm/src/OpenAIClient.js:79:83)
    at new LobeAzureOpenAI (webpack-internal:///(rsc)/./src/libs/agent-runtime/azureOpenai/index.ts:52:23)
BrandonStudio commented 4 months ago

Failed here: https://github.com/lobehub/lobe-chat/blob/main/src/libs/agent-runtime/azureOpenai/index.ts#L38-L42

BrandonStudio commented 4 months ago

At https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/src/util/userAgentPlatform-browser.mts#L66-L69 localNavigator is undefined.

I think we should call the node runtime, rather than the browser runtime.

arvinxx commented 4 months ago

@BrandonStudio 感觉应该锁一下 @azure/core-rest-pipeline 版本就好了,可以来提个 PR ?

lobehubbot commented 4 months ago

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


@BrandonStudio I feel like we should lock the @azure/core-rest-pipeline version. Can you raise a PR?

BrandonStudio commented 4 months ago

@arvinxx Lock is just a workaround, I do think we should switch backend environment to Node.

https://github.com/Azure/azure-sdk-for-js/pull/30194/files#r1657657267

arvinxx commented 4 months ago

@BrandonStudio 服务端 runtime 是 edge runtime ,这个能确保发出来的请求是贴近客户这一侧的,以及 stream 时长不超时。切到 node runtime 可以也可以,但是就是默认有 10s 时长限制。

我感觉这个根本上还是这个依赖的问题,应该推 azure 修才是。

lobehubbot commented 4 months ago

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


@BrandonStudio The server-side runtime is edge runtime, which ensures that the request sent is close to the client side and the stream duration does not time out. You can switch to node runtime, but there is a 10s time limit by default.

I feel that this is basically a dependency problem, and it should be repaired by Azure.

BrandonStudio commented 4 months ago

我感觉这个根本上还是这个依赖的问题,应该推 azure 修才是。

OK, waiting for their reply.

arvinxx commented 4 months ago

fix in https://github.com/lobehub/lobe-chat/pull/3066

lobehubbot commented 4 months ago

✅ @htdohk

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