Open Arash-Sabet opened 2 years ago
@Y-Sindo just wondering, is this a question that you may know the answer? Thanks.
Microsoft.Azure.SignalR.Common.ServiceConnectionNotActiveException: The connection is not active, data cannot be sent to the service.
Your function host didn't successfully establish WebSocket connection with Azure SignalR Service. There might be some network issues in your container. You could enable Debug
log level to check the logs when the host was trying to connect to SignalR Service to see why.
Describe the bug
The code fails to add a user to a signalR group in a docker container despite the negotiation passes successfully.
The function's code is per the snippet below:
The following exception is thrown when calling this function by POSTMAN despite the function works fine out of the docker context e.g. VS 2022. Please note that there is a reverse proxy in place to accommodate CORS that performs well as other functions are working properly.
Exceptions (if any)
myfunction | info: Function.AddToGroup[1] myfunction | Executing 'Functions.AddToGroup' (Reason='This function was programmatically called via the host APIs.', Id=c9487a71-046c-4bdb-bab5-85037718ce31) myfunction | fail: Function.AddToGroup[3] myfunction | Executed 'Functions.AddToGroup' (Failed, Id=c9487a71-046c-4bdb-bab5-85037718ce31, Duration=6ms) myfunction | Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.AddToGroup myfunction | ---> Microsoft.Azure.SignalR.Common.ServiceConnectionNotActiveException: The connection is not active, data cannot be sent to the service. myfunction | at Microsoft.Azure.SignalR.ServiceConnectionContainerBase.WriteWithRetry(ServiceMessage serviceMessage, Int32 initial, Int32 count) myfunction | at Microsoft.Azure.WebJobs.Extensions.SignalRService.AzureSignalRClient.AddUserToGroup(String userId, String groupName) myfunction | at Microsoft.Azure.WebJobs.Extensions.SignalRService.SignalRAsyncCollectorb__0>d.MoveNext() in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 170
myfunction | --- End of stack trace from previous location ---
myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.BindOutputsAsync(Object input, Binder binder, ScriptInvocationResult result) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 174
myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 98
myfunction | at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 82
myfunction | at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task
1.AddAsync(T item, CancellationToken cancellationToken) myfunction | at Microsoft.Azure.WebJobs.Script.Binding.FunctionBinding.BindAsyncCollectorAsync[T](BindingContext context) in /src/azure-functions-host/src/WebJobs.Script/Binding/FunctionBinding.cs:line 199 myfunction | at Microsoft.Azure.WebJobs.Script.Binding.ExtensionBinding.BindAsync(BindingContext context) in /src/azure-functions-host/src/WebJobs.Script/Binding/ExtensionBinding.cs:line 84 myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.<>c__DisplayClass13_0.<<BindOutputsAsync>b__0>d.MoveNext() in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 170 myfunction | --- End of stack trace from previous location --- myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.BindOutputsAsync(Object input, Binder binder, ScriptInvocationResult result) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 174 myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 98 myfunction | at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 82 myfunction | at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task
1 src) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs:line 225 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 596 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 542 reverseproxy | 172.18.0.1 - - [22/Feb/2022:20:06:19 +0000] "GET /api/addtogroup/MyGroup/MyId HTTP/1.1" 500 0 "-" "PostmanRuntime/7.29.0" "-" myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 320 myfunction | --- End of inner exception stack trace --- myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 367 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 108 myfunction | fail: Host.Results[0] myfunction | Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.AddToGroup myfunction | ---> Microsoft.Azure.SignalR.Common.ServiceConnectionNotActiveException: The connection is not active, data cannot be sent to the service. myfunction | at Microsoft.Azure.SignalR.ServiceConnectionContainerBase.WriteWithRetry(ServiceMessage serviceMessage, Int32 initial, Int32 count) myfunction | at Microsoft.Azure.WebJobs.Extensions.SignalRService.AzureSignalRClient.AddUserToGroup(String userId, String groupName) myfunction | at Microsoft.Azure.WebJobs.Extensions.SignalRService.SignalRAsyncCollector
1.AddAsync(T item, CancellationToken cancellationToken) myfunction | at Microsoft.Azure.WebJobs.Script.Binding.FunctionBinding.BindAsyncCollectorAsync[T](BindingContext context) in /src/azure-functions-host/src/WebJobs.Script/Binding/FunctionBinding.cs:line 199myfunction | at Microsoft.Azure.WebJobs.Script.Binding.ExtensionBinding.BindAsync(BindingContext context) in /src/azure-functions-host/src/WebJobs.Script/Binding/ExtensionBinding.cs:line 84 myfunction | at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.<>c__DisplayClass13_0.<
1 src) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs:line 225 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker
2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 596 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 542 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 320 myfunction | --- End of inner exception stack trace --- myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 367 myfunction | at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 108Further technical details
.NET info is per below: