microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.36k stars 3.14k forks source link

Cannot read properties of undefined (reading 'toLocaleLowerCase') #912

Closed doolachen closed 1 year ago

doolachen commented 1 year ago

I deployed the copilot-chat-app following the README steps. I got this error once I send any characters. image

hunk-fe commented 1 year ago

I get the same problem!

hedaiping commented 1 year ago

i got same problem

evchaki commented 1 year ago

@doolachen , thank you for bringing this up. We have logged a bug and are working to fix it.

astorm-z commented 1 year ago

i got same problem

doolachen commented 1 year ago

@evchaki , I really appreciate the effort you put into fixing this bug. I'm curious to know what caused this error. I followed the deployment process as documented, and it seems like others didn't encounter this issue. Did I miss a step somewhere, or could there be some underlying project-specific issues at play?

cooptest commented 1 year ago

@doolachen There is no such error when I switch to the edge browser, but the message robot does not reply

cooptest commented 1 year ago

@doolachen 换成edge浏览器不会报错,但是给机器人发消息它不回复

hathind-ms commented 1 year ago

Can you please confirm the following:

  1. AI endpoints are set in appsettings.json - This needs to be updated in 2-3 places based on whether you want to use Planner or not. Check these sections - Completion, Embedding and/or Planner
  2. Key for AI resource is set - This can either be set using dotnet secrets or updated in appsettings.json in 2-3 places similar to step 1
  3. Confirm your webapi is running at : https://localhost:40443/probe
  4. You have a valid .env file with following values set:
    REACT_APP_BACKEND_URI=https://localhost:40443/
    REACT_APP_AAD_CLIENT_ID={Your Application (client) ID}
    REACT_APP_AAD_AUTHORITY=https://login.microsoftonline.com/common

Reference this ReadMe for more details: https://github.com/microsoft/semantic-kernel/blob/main/samples/apps/copilot-chat-app/README.md

teresaqhoang commented 1 year ago

Hi @doolachen, @hunk-fe, @daiping0323, @forczc, AND @cooptest, do you see a screen that says Semantic Kernel service up and running when you navigate to https://localhost:40443/probe?

Also, are you guys following the README exactly (spinning up the webapi and WebApp locally) or are you using one of the deployment templates to deploy Semantic Kernel to Azure?

cooptest commented 1 year ago

Deploy and install locally (http://localhost:3000)

I can start successfully and get a response

You cannot log in to Copilot chat with the same account as the Azure subscription, you need to change another account, otherwise an error will be reported no matter what content is sent

Is there any plan to deploy the configuration on the server? Now it can only be accessed on localhost, but I want to access it through the server IP on the Internet

Tangroo commented 1 year ago

Hi @doolachen, @hunk-fe, @daiping0323, @forczc, AND @cooptest, do you see a screen that says Semantic Kernel service up and running when you navigate to https://localhost:40443/probe?

Also, are you guys following the README exactly (spinning up the webapi and WebApp locally) or are you using one of the deployment templates to deploy Semantic Kernel to Azure?

I get the same problem! I deployed strictly according to README. Is it necessary to deploy the Semantic Kernel to Azure and then deploy the copilot chat locally?Or simply deploy the copilot chat app locally?

Tangroo commented 1 year ago

https://github.com/microsoft/semantic-kernel#sample-apps- In the second requirement, it says that you need to configure the Azure Functions Core Tools. Do you need to deploy this tool locally ahead of time? Despite installing the tool, I still see the same error message.

teresaqhoang commented 1 year ago

Hi @doolachen, @hunk-fe, @daiping0323, @forczc, AND @cooptest, do you see a screen that says Semantic Kernel service up and running when you navigate to https://localhost:40443/probe? Also, are you guys following the README exactly (spinning up the webapi and WebApp locally) or are you using one of the deployment templates to deploy Semantic Kernel to Azure?

I get the same problem! I deployed strictly according to README. Is it necessary to deploy the Semantic Kernel to Azure and then deploy the copilot chat locally?Or simply deploy the copilot chat app locally?

Hey @Tangroo, It is not necessary to deploy the webapi to Azure, running it locally should work fine!

In the second requirement, it says that you need to configure the Azure Functions Core Tools. Do you need to deploy this tool locally ahead of time? Despite installing the tool, I still see the same error message.

Copilot Chat actually doesn't require Azure Functions Core Tools (our bad, we should update the documentation). The other sample apps leverage the KernelHttpServer as the service API, and it's deployed against Azure Function Runtime, so those tools are required there to run the service locally. Copilot uses an Asp.Net web application to expose SK APIs.

teresaqhoang commented 1 year ago

Deploy and install locally (http://localhost:3000)

I can start successfully and get a response

You cannot log in to Copilot chat with the same account as the Azure subscription, you need to change another account, otherwise an error will be reported no matter what content is sent

Hm, this is interesting. We haven't observed this on our end, but I am debugging now. Do you know if you have any specific tenant restrictions?

Is there any plan to deploy the configuration on the server? Now it can only be accessed on localhost, but I want to access it through the server IP on the Internet

Yes! In a couple weeks. @glahaye is working to have something to deploy the frontend.

teresaqhoang commented 1 year ago

@cooptest @Tangroo I'm unable to reproduce this issue. Do you guys have the latest changes pulled? We've pushed a lot of bug fixes in the past week

Tangroo commented 1 year ago

@cooptest @Tangroo I'm unable to reproduce this issue. Do you guys have the latest changes pulled? We've pushed a lot of bug fixes in the past week

Yes, I pulled the latest code and cloned it again yesterday. However, if I redeploy it, I will still report the same error.

teresaqhoang commented 1 year ago

@cooptest @Tangroo I'm unable to reproduce this issue. Do you guys have the latest changes pulled? We've pushed a lot of bug fixes in the past week

Yes, I pulled the latest code and cloned it again yesterday. However, if I redeploy it, I will still report the same error.

Can you send a screenshot of the error? We no longer have the getAudienceMemberForId method, so I’m wondering what the stack looks like now.

Tangroo commented 1 year ago

image the webapi started successfully. image When the webapp is just opened, it is also in a normal state image When I send a message to it, it jumps directly to this error page

astorm-z commented 1 year ago

I have the same issue as @Tangroo, and I noticed there is an error with this request on the network. ur: https://localhost:40443/chat image

coopliu commented 1 year ago

@cooptest @Tangroo I'm unable to reproduce this issue. Do you guys have the latest changes pulled? We've pushed a lot of bug fixes in the past week

No, I changed a Microsoft account and logged in to Copilot Chat again, it can run successfully and receive a reply

1
astorm-z commented 1 year ago

@cooptest @Tangroo I'm unable to reproduce this issue. Do you guys have the latest changes pulled? We've pushed a lot of bug fixes in the past week

No, I changed a Microsoft account and logged in to Copilot Chat again, it can run successfully and receive a reply 1

me too

teresaqhoang commented 1 year ago

What kind of accounts were you using before? Personal? @forczc @Tangroo

astorm-z commented 1 year ago

What kind of accounts were you using before? Personal? @forczc @Tangroo

yes,Personal

Codingsaikou commented 1 year ago

I changed a Microsoft account and logged in to Copilot Chat again, but cant connect to

fail: Microsoft.SemanticKernel.IKernel[0] Error executing request, max retry count reached. Reason: System.Net.Http.HttpRequestException System.Net.Http.HttpRequestException: (api.openai.com:443) ---> System.Net.Sockets.SocketException (10060): at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at Microsoft.SemanticKernel.Reliability.DefaultHttpRetryHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) warn: Microsoft.SemanticKernel.IKernel[0]

teresaqhoang commented 1 year ago

I changed a Microsoft account and logged in to Copilot Chat again, but cant connect to

fail: Microsoft.SemanticKernel.IKernel[0] Error executing request, max retry count reached. Reason: System.Net.Http.HttpRequestException System.Net.Http.HttpRequestException: (api.openai.com:443) ---> System.Net.Sockets.SocketException (10060): at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at Microsoft.SemanticKernel.Reliability.DefaultHttpRetryHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) warn: Microsoft.SemanticKernel.IKernel[0]

Hi @Codingsaikou, this seems like a separate issue related to OpenAI capacity. OpenAI might have been throttled at the time you tried to connect. Can you try again? If the issue persists, please open another issue thread for help. Thanks!

teresaqhoang commented 1 year ago

Hi @doolachen, @hunk-fe, @daiping0323, @forczc, @cooptest, I just merged a fix into main to solve this issue.

Turns out Msal doesn't require "name" as a required property on the account, so when it was undefined (as it is for most personal accounts), we'd see the null pointer error when trying to parse the value on the front and backend.

I've implemented a solution that falls back to the account username if the name property is empty, so your personal accounts should work with Copilot chat now.

Thanks for calling this to our attention and all of your help in debugging! Closing this issue. Please reopen if the problem persists.