-
Notifications
You must be signed in to change notification settings - Fork 53
Description
When RaiseEventAsync("NonExistantId", "SomeEvent1", "SomeData");' is called in the HttpTrigger below, we receive an exception of type Grpc.Core.RpcExceptionwith the message:Status(StatusCode="Unknown", Detail="Exception was thrown by handler.")`
Errormessage:
[2024-10-23T09:25:13.418Z] Host lock lease acquired by instance ID '000000000000000000000000430AE0B1'.
[2024-10-23T09:25:18.221Z] Executing 'Functions.FireEvent1' (Reason='This function was programmatically called via the host APIs.', Id=6945c0db-70e1-40c1-bf15-0df2e7e486d7)
[2024-10-23T09:25:18.508Z] dbug: DurableFunctionsIsolated.ExternalTriggers[0]
[2024-10-23T09:25:18.509Z] Firing event from trigger: 'FireEvent1'
[2024-10-23T09:25:31.249Z] Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="Exception was thrown by handler.")
[2024-10-23T09:25:31.250Z] at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.RaiseEventAsync(String instanceId, String eventName, Object eventPayload, CancellationToken cancellation)
[2024-10-23T09:25:31.251Z] at DurableFunctionsIsolated.ExternalTriggers.FireEvent1(HttpRequestData request, DurableTaskClient client) in D:\playground\FunctionAppIsolatedDotNet7\DurableFunctionsIsolated\ExternalTriggers.cs:line 25
Example
Example of HttpTrigger used. The catch implementation is just a default here to see in the debugger what kind of exception is thrown:
[Function(nameof(FireEvent1))]
public async Task<HttpResponseData> FireEvent1([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "trigger/event1")] HttpRequestData request,
[DurableClient] DurableTaskClient client)
{
_logger.LogDebug("Firing event from trigger: '{trigger}'", nameof(FireEvent1));
try
{
await client.RaiseEventAsync("NonExistantId", "SomeEvent1", "SomeData");//Constants.OrchestratorInstanceId, Constants.Event1, "Some data from event 1");
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
return request.CreateResponse(HttpStatusCode.OK);
}The documentation of the .RaiseEvent as stated here says the following:
Raised events for a completed or non-existent orchestration instance will be silently discarded.
That is obviously not the case. Some other folks have the same issue. Check this issue