semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Cannot read properties of undefined (reading 'toLocaleLowerCase')

Open doolachen opened this issue 2 years ago • 10 comments

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

doolachen avatar May 10 '23 07:05 doolachen

I get the same problem!

hunk-fe avatar May 11 '23 02:05 hunk-fe

i got same problem

hedaiping avatar May 11 '23 03:05 hedaiping

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

evchaki avatar May 11 '23 21:05 evchaki

i got same problem

astorm-z avatar May 12 '23 05:05 astorm-z

@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?

doolachen avatar May 12 '23 08:05 doolachen

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

cooptest avatar May 12 '23 09:05 cooptest

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

cooptest avatar May 12 '23 09:05 cooptest

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

hathind-ms avatar May 16 '23 18:05 hathind-ms

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?

teresaqhoang avatar May 16 '23 21:05 teresaqhoang

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

cooptest avatar May 17 '23 07:05 cooptest

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 avatar May 18 '23 04:05 Tangroo

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.

Tangroo avatar May 18 '23 07:05 Tangroo

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 avatar May 18 '23 19:05 teresaqhoang

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 avatar May 18 '23 19:05 teresaqhoang

@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

teresaqhoang avatar May 18 '23 19:05 teresaqhoang

@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.

Tangroo avatar May 19 '23 01:05 Tangroo

@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.

teresaqhoang avatar May 19 '23 01:05 teresaqhoang

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

Tangroo avatar May 19 '23 01:05 Tangroo

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

astorm-z avatar May 19 '23 02:05 astorm-z

@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

coopliu avatar May 19 '23 04:05 coopliu

@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

astorm-z avatar May 19 '23 05:05 astorm-z

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

teresaqhoang avatar May 19 '23 21:05 teresaqhoang

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

yes,Personal

astorm-z avatar May 20 '23 11:05 astorm-z

I changed a Microsoft account and logged in to Copilot Chat again, but cant connect to <api.openai.com>

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.<ConnectAsync>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]

Codingsaikou avatar May 22 '23 08:05 Codingsaikou

I changed a Microsoft account and logged in to Copilot Chat again, but cant connect to <api.openai.com>

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 avatar May 22 '23 23:05 teresaqhoang

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.

teresaqhoang avatar May 22 '23 23:05 teresaqhoang