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

The SSL connection could not be established

Open rust17 opened this issue 2 years ago • 11 comments

Describe the bug In Simple Chat Summary App, when I click save button. The /api/skills/funskill/invoke/joke return UnknownError: Something went wrong: The SSL connection could not be established, see inner exception. Any help will be appreciative !

image

To Reproduce Steps to reproduce the behavior:

  1. cd semantic-kernel/samples/dotnet/KernelHttpServer, run func start --csharp --verbose.
  2. cd semantic-kernel/samples/apps/chat-summary-webapp-react, run yarn start.
  3. open url in broswer.
  4. fill the fields of OpenAI Key and Model, and click save.

Expected behavior Save success.

Desktop (please complete the following information):

  • OS: ubuntu 20.04

Additional context when I click save button, log output:

[2023-03-29T07:29:01.470Z] Executing HTTP request: {
[2023-03-29T07:29:01.470Z]   requestId: "96b953fb-ee5d-4fd7-a7cf-7537e3769ab9",
[2023-03-29T07:29:01.470Z]   method: "POST",
[2023-03-29T07:29:01.470Z]   userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
[2023-03-29T07:29:01.470Z]   uri: "/api/skills/funskill/invoke/joke"
[2023-03-29T07:29:01.470Z] }
[2023-03-29T07:29:01.471Z] Executing 'Functions.InvokeFunction' (Reason='This function was programmatically called via the host APIs.', Id=5e416a89-b20c-403c-91aa-f32e3b9b50d1)
[2023-03-29T07:29:01.474Z] Embedding backend has not been supplied.
[2023-03-29T07:29:03.968Z] Executed 'Functions.InvokeFunction' (Succeeded, Id=5e416a89-b20c-403c-91aa-f32e3b9b50d1, Duration=2497ms)

rust17 avatar Mar 29 '23 08:03 rust17

Assuming you are building everything from source, would you mind changing all references where CheckCertificateRevocationList = true to CheckCertificateRevocationList = false:

image

Then func start KernelHttpServer and try the web app again.

craigomatic avatar Mar 30 '23 00:03 craigomatic

@craigomatic Thanks for your reply. I change all references as follow, but still doesn't work (still 400 as above): image

rust17 avatar Mar 30 '23 03:03 rust17

Hmm, ok thank you for trying that.

Would it be possible to get a stack trace from the KernelHttpServer?

From memory the client app is only getting the top level error message, so there is likely some more interesting detail in the stacktrace we can use to track this down.

craigomatic avatar Mar 30 '23 04:03 craigomatic

Sorry. I'm not familiar with .NET. How can I get a stack trace from the KernelHttpServer?

rust17 avatar Mar 30 '23 07:03 rust17

@rust17 thank you for the bug info here, we will take a look at this.

evchaki avatar Mar 30 '23 20:03 evchaki

@evchaki Thanks for your reply. It’s possible that my location may have restrictions on accessing certain websites. I tried to use a proxy to access and forward all requests through the local port 1087, but it failed when starting func start --csharp. The failure log is as follows:

logs

[2023-03-31T02:36:13.060Z] Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error st
arting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while u
nable to establish HTTP/2 connection.", DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 
2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.                           
[2023-03-31T02:36:13.060Z]    at System.Net.Http.HttpConnectionPool.ThrowGetVersionException(HttpRequestMessage reques
t, Int32 desiredVersion)                                                                                              
[2023-03-31T02:36:13.060Z]    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestM
essage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)                            
[2023-03-31T02:36:13.060Z]    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, 
CancellationToken cancellationToken)                                                                                  
[2023-03-31T02:36:13.060Z]    at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.SendAsync(HttpRequestMessage re
quest, CancellationToken cancellationToken)                                                                           
[2023-03-31T02:36:13.060Z]    at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 ti
meout)")                                                                                                              
[2023-03-31T02:36:13.061Z]    at Grpc.Net.Client.Internal.HttpContentClientStreamWriter`2.WriteAsyncCore[TState](Func`
5 writeFunc, TState state)
[2023-03-31T02:36:13.061Z]    at Grpc.Net.Client.Internal.HttpContentClientStreamWriter`2.WriteCoreAsync(TRe[409/1175]
age, CancellationToken cancellationToken)
[2023-03-31T02:36:13.061Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.SendSt
artStreamMessageAsync(IClientStreamWriter`1 requestStream) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFac
tory.cs:line 92
[2023-03-31T02:36:13.061Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.StartA
sync(IMessageProcessor processor, CancellationToken token) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFac
tory.cs:line 74
[2023-03-31T02:36:13.061Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.Create
AndStartAsync(GrpcHostChannel outputChannel, GrpcWorkerStartupOptions startupOptions, IMessageProcessor processor, Can
cellationToken token) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFactory.cs:line 58
[2023-03-31T02:36:13.061Z]    at Microsoft.Azure.Functions.Worker.GrpcWorker.StartAsync(CancellationToken token) in D:
\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorker.cs:line 71
[2023-03-31T02:36:13.061Z]    at Microsoft.Azure.Functions.Worker.WorkerHostedService.StartAsync(CancellationToken can
cellationToken) in D:\a\_work\1\s\src\DotNetWorker.Core\WorkerHostedService.cs:line 25
[2023-03-31T02:36:13.061Z]    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationT
oken)
[2023-03-31T02:36:13.062Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, C
ancellationToken token)
[2023-03-31T02:36:13.062Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, C
ancellationToken token)
[2023-03-31T02:36:13.062Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
[2023-03-31T02:36:13.062Z]    at KernelHttpServer.Program.Main() in /home/circle33/code/semantic-kernel/samples/dotnet
/KernelHttpServer/Program.cs:line 37
[2023-03-31T02:36:14.230Z] Language Worker Process exited. Pid=109129.                                      [385/1175]
[2023-03-31T02:36:14.230Z] dotnet exited with code 134 (0x86). Unhandled exception. Grpc.Core.RpcException: Status(Sta
tusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version p
olicy RequestVersionOrHigher while unable to establish HTTP/2 connection.", DebugException="System.Net.Http.HttpReques
tException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 co
nnection.
[2023-03-31T02:36:14.244Z] Failed to start a new language worker for runtime: dotnet-isolated.
[2023-03-31T02:36:14.245Z] System.Private.CoreLib: A task was canceled.
[2023-03-31T02:36:14.649Z] Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error st
arting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while u
nable to establish HTTP/2 connection.", DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 
2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.
[2023-03-31T02:36:14.649Z]    at System.Net.Http.HttpConnectionPool.ThrowGetVersionException(HttpRequestMessage reques
t, Int32 desiredVersion)
[2023-03-31T02:36:14.650Z]    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestM
essage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
[2023-03-31T02:36:14.650Z]    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, 
CancellationToken cancellationToken)
[2023-03-31T02:36:14.650Z]    at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.SendAsync(HttpRequestMessage re
quest, CancellationToken cancellationToken)
[2023-03-31T02:36:14.650Z]    at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 ti
meout)")
[2023-03-31T02:36:14.650Z]    at Grpc.Net.Client.Internal.HttpContentClientStreamWriter`2.WriteCoreAsync(TRequest mess
age, CancellationToken cancellationToken)
[2023-03-31T02:36:14.650Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.SendSt
artStreamMessageAsync(IClientStreamWriter`1 requestStream) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFac
tory.cs:line 92
[2023-03-31T02:36:14.650Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.StartA
sync(IMessageProcessor processor, CancellationToken token) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFac
tory.cs:line 74
[2023-03-31T02:36:14.650Z]    at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.Create
AndStartAsync(GrpcHostChannel outputChannel, GrpcWorkerStartupOptions startupOptions, IMessageProcessor processor, Can
cellationToken token) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFactory.cs:line 58
[2023-03-31T02:36:14.650Z]    at Microsoft.Azure.Functions.Worker.GrpcWorker.StartAsync(CancellationToken token) in D:
\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorker.cs:line 71
[2023-03-31T02:36:14.650Z]    at Microsoft.Azure.Functions.Worker.WorkerHostedService.StartAsync(CancellationToken can
cellationToken) in D:\a\_work\1\s\src\DotNetWorker.Core\WorkerHostedService.cs:line 25
[2023-03-31T02:36:14.650Z]    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationT
oken)
[2023-03-31T02:36:14.651Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, C
ancellationToken token)
[2023-03-31T02:36:14.651Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, C
ancellationToken token)
[2023-03-31T02:36:14.651Z]    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
[2023-03-31T02:36:14.651Z]    at KernelHttpServer.Program.Main() in /home/circle33/code/semantic-kernel/samples/dotnet
/KernelHttpServer/Program.cs:line 37

rust17 avatar Mar 31 '23 03:03 rust17

i have a similar questions,any solutions?

ydz00ydz avatar May 05 '23 06:05 ydz00ydz

i have a similar questions,any solutions?

换个好点的梯子解决了。。。

ydz00ydz avatar May 05 '23 06:05 ydz00ydz

@craigomatic can you take a look at this?

evchaki avatar May 16 '23 20:05 evchaki

I have the same problem

PaulC-F1000 avatar May 18 '23 15:05 PaulC-F1000

This has been a tricky one to repro at this end.

Could I ask for someone on the thread experiencing the issue to try and repro with one of the simpler samples, ie: https://github.com/microsoft/semantic-kernel/blob/main/samples/dotnet/kernel-syntax-examples/Example04_CombineLLMPromptsAndNativeCode.cs

I think it will result in the same error, however it will allow us to remove Azure Functions from the list of potential contributors to the issue.

craigomatic avatar May 18 '23 19:05 craigomatic

@craigomatic, I edit the samples/dotnet/kernel-syntax-examples/Program.cs like this: image Then,

dotnet run Program.cs
outputs:

======== LLMPrompts ========                                                                                  
fail: object[0]                                                                                               
      Something went wrong in pipeline step 0: bing.Search. Error: Response status code does not indicate succ
ess: 401 (PermissionDenied).                                                                                  
      System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (PermissionDen
ied).                                                                                                         
         at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()                                     
         at Microsoft.SemanticKernel.Skills.Web.Bing.BingConnector.SearchAsync(String query, Int32 count, Int3
2 offset, CancellationToken cancellationToken) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.W
eb/Bing/BingConnector.cs:line 47                                                                              
         at Microsoft.SemanticKernel.Skills.Web.WebSearchEngineSkill.SearchAsync(String query, SKContext conte
xt) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs:line 45         
         at Microsoft.SemanticKernel.SkillDefinition.SKFunction.c.b__40_4>d.MoveNext() in 
/home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/SkillDefinition/SKFunction.cs:line 484            
      --- End of stack trace from previous location ---                                                       
         at Microsoft.SemanticKernel.Kernel.RunAsync(ContextVariables variables, CancellationToken cancellatio
nToken, ISKFunction[] pipeline) in /home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/Kernel.cs:line 
191                                                                                                           
fail: object[0]                                                                                               
      Something went wrong in pipeline step 0: bing.Search. Error: Response status code does not indicate succ
ess: 401 (PermissionDenied). 
         System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (PermissionDen
ied).
         at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
         at Microsoft.SemanticKernel.Skills.Web.Bing.BingConnector.SearchAsync(String query, Int32 count, Int3
2 offset, CancellationToken cancellationToken) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.W
eb/Bing/BingConnector.cs:line 47
         at Microsoft.SemanticKernel.Skills.Web.WebSearchEngineSkill.SearchAsync(String query, SKContext conte
xt) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs:line 45
         at Microsoft.SemanticKernel.SkillDefinition.SKFunction.c.b__40_4>d.MoveNext() in 
/home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/SkillDefinition/SKFunction.cs:line 484
      --- End of stack trace from previous location --- 
         at Microsoft.SemanticKernel.Kernel.RunAsync(ContextVariables variables, CancellationToken cancellatio
nToken, ISKFunction[] pipeline) in /home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/Kernel.cs:line 
191
What's the tallest building in South America?

fail: object[0] Something went wrong in pipeline step 0: bing.Search. Error: Response status code does not indicate succ ess: 401 (PermissionDenied). System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (PermissionDen ied). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at Microsoft.SemanticKernel.Skills.Web.Bing.BingConnector.SearchAsync(String query, Int32 count, Int3 2 offset, CancellationToken cancellationToken) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.W eb/Bing/BingConnector.cs:line 47 at Microsoft.SemanticKernel.Skills.Web.WebSearchEngineSkill.SearchAsync(String query, SKContext conte xt) in /home/circle/code/semantic-kernel/dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs:line 45 at Microsoft.SemanticKernel.SkillDefinition.SKFunction.<>c.<<GetDelegateInfo>b__40_4>d.MoveNext() in /home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/SkillDefinition/SKFunction.cs:line 484 --- End of stack trace from previous location --- at Microsoft.SemanticKernel.Kernel.RunAsync(ContextVariables variables, CancellationToken cancellatio nToken, ISKFunction[] pipeline) in /home/circle/code/semantic-kernel/dotnet/src/SemanticKernel/Kernel.cs:line 191 Bing Answer: Error: Response status code does not indicate success: 401 (PermissionDenied).

Summary: Error: Response status code does not indicate success: 401 (PermissionDenied).

Notes: Error: Response status code does not indicate success: 401 (PermissionDenied).

== DONE ==

rust17 avatar May 28 '23 07:05 rust17

Thank you for trying this, may I ask if you had a valid Bing key setup before running the sample?

I believe the 401 you are getting is the Bing API complaining about the absence of an API key.

craigomatic avatar May 30 '23 22:05 craigomatic

@craigomatic I got the key from https://www.bing.com/webmasters. Can you tell me how to get a valid Bing key?

rust17 avatar Jun 07 '23 02:06 rust17

You should be able to get a bing web api key via https://www.microsoft.com/en-us/bing/apis/bing-web-search-api

craigomatic avatar Jun 07 '23 14:06 craigomatic

@rust17 were you able to try this with a key via the link above?

Anyone else on the thread still seeing this issue and/or willing to try the smaller sample suggested above?

craigomatic avatar Jun 14 '23 16:06 craigomatic

@craigomatic To get a key, I need to bind a master card, which is too difficult for me.

rust17 avatar Jun 15 '23 04:06 rust17