Azure / Azure/azure-functions-host
What is the recommended universe way to get the exact remote error message returned from workers of different languages as function extensions author
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### Is your question related to a specific version? If so, please specify:
No
#### What language does your question apply to?
All
#### Question
I'm trying to enable SignalR extensions to retrieve error messages from exceptions thrown by functions executed by different kinds of workers, including Dotnet isolated worker, NodeJs worker, and others. However, it seems that different workers set the error message in different ways, making it difficult to retrieve the message in a consistent manner.
For example, this is a SignalR trigger function in dotnet isolated worker:
```cs
[Function(nameof("Subscribe"))]
[SignalROutput(HubName = "Hub", ConnectionStringSetting = "AzureSignalRConnectionString")]
public SignalRGroupAction Subscribe(
[SignalRTrigger("Hub", "messages", "Subscribe")]
SignalRInvocationContext invocationContext
)
{
throw new HubException("This error will be sent to the client!");
}
```
We need to return the exact error message "This error will be sent to the client!" to SignalR client per SignalR protocol.
According to my tests locally (function CLI version 4.0.5441), we can get the information about remote exception from `Host.Excecutors.FunctionResults.Exception.InnerException`, whose actual type is `RpcException`.
However, for NodeJs worker, the remote exception message equals to `RpcException.RemoteMessage` field, while in Dotnet isolated worker, how to get the remote error message depends on the user settings and it doesn't set the `RpcException.RemoteMessage` field now, as explained in this [source code](https://github.com/Azure/azure-functions-dotnet-worker/blob/4e8849e632a77a421b268733c8074a418cf5d84d/src/DotNetWorker.Grpc/RpcExtensions.cs#L125C9-L161).
I haven't tested the behavior on other workers yet, but I assume there are other differences in behavior. Is there a general guidance on how to retrieve remote error messages in a consistent way across different kinds of workers?
Original issue: https://github.com/Azure/azure-functions-dotnet-worker/issues/1806
@liliankasem @fabiocav
Contributor guide
Research direction
Start by comparing Host.Executors.FunctionResults.Exception.InnerException with the worker behavior described in src/DotNetWorker.Grpc/RpcExtensions.cs, including the linked lines. Reproduce the shown .NET isolated and Node.js cases using the stated Functions CLI version, then document whether consistent remote-message guidance exists across workers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, nodejs
- Domain
- api, backend, cloud
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100