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] v1.1.11 Azure Error #3037

Closed
htdohk opened this issue Jun 25, 2024 · 32 comments
Closed

[Bug] v1.1.11 Azure Error #3037

htdohk opened this issue Jun 25, 2024 · 32 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@htdohk
Copy link

htdohk commented Jun 25, 2024

📦 部署环境

Vercel

📌 软件版本

v1.1.11

💻 系统环境

macOS

🌐 浏览器

Chrome

🐛 问题描述

这个提交之后,Azure崩了。Vercel回滚到上个部署是OK的。
截屏2024-06-25 20 56 31

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

@htdohk htdohk added the 🐛 Bug Something isn't working | 缺陷 label Jun 25, 2024
@lobehubbot
Copy link
Member

👀 @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
Copy link

bt-nia commented Jun 25, 2024

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
Copy link
Author

htdohk commented Jun 26, 2024

1.1.10 works fine~

@BrandonStudio
Copy link
Contributor

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

@lobehubbot
Copy link
Member

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
Copy link

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

@htdohk
Copy link
Author

htdohk commented Jun 26, 2024

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

@arvinxx
Copy link
Contributor

arvinxx commented Jun 26, 2024

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

@lobehubbot
Copy link
Member

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
Copy link
Author

htdohk commented Jun 26, 2024

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

@lobehubbot
Copy link
Member

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
Copy link

v1.1.12 版本也有这个问题

@lobehubbot
Copy link
Member

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


v1.1.12 version also has this problem

@breakstring
Copy link

v1.1.12 版本也有这个问题

+1

@lobehubbot
Copy link
Member

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


v1.1.12 version also has this problem

+1

@htdohk
Copy link
Author

htdohk commented Jun 27, 2024

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

@lobehubbot
Copy link
Member

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
Copy link
Contributor

BrandonStudio commented Jun 27, 2024

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

客户端请求没问题

@lobehubbot
Copy link
Member

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
Copy link
Contributor

arvinxx commented Jun 27, 2024

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

@lobehubbot
Copy link
Member

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
Copy link
Contributor

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/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/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/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/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/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgentPlatform.js:43:24)
    at getUserAgentValue (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/util/userAgent.js:32:89)
    at tracingPolicy (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/policies/tracingPolicy.js:33:99)
    at createPipelineFromOptions (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/core-rest-pipeline/dist/browser/createPipelineFromOptions.js:55:98)
    at createDefaultPipeline (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/clientHelpers.js:46:106)
    at getClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure-rest/core-client/dist/browser/getClient.js:26:94)
    at createClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/rest/openAIClient.js:34:86)
    at createOpenAI (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@azure/openai/dist-esm/src/api/OpenAIContext.js:10:85)
    at new OpenAIClient (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/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
Copy link
Contributor

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

@BrandonStudio
Copy link
Contributor

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
Copy link
Contributor

arvinxx commented Jun 27, 2024

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

@lobehubbot
Copy link
Member

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
Copy link
Contributor

@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
Copy link
Contributor

arvinxx commented Jun 28, 2024

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

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

@lobehubbot
Copy link
Member

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
Copy link
Contributor

BrandonStudio commented Jun 28, 2024

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

OK, waiting for their reply.

@arvinxx
Copy link
Contributor

arvinxx commented Jun 28, 2024

fix in #3066

@arvinxx arvinxx closed this as completed Jun 28, 2024
@lobehubbot
Copy link
Member

@htdohk

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

jeremymeng pushed a commit to Azure/azure-sdk-for-js that referenced this issue Jun 28, 2024
…fined localNavigator (#30194)

`localNavigator` may be `undefined` at L69.


### Packages impacted by this PR
core-rest-pipeline

### Issues associated with this PR
lobehub/lobe-chat#3037

### Describe the problem that is addressed by this PR
`localNavigator` may be undefined at L69 on some platform, for example, Edge Runtime.
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

8 participants