Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RaiseEventAsync throws Grpc.Core.RpcException #350

Open
Fazer01 opened this issue Oct 23, 2024 · 1 comment
Open

RaiseEventAsync throws Grpc.Core.RpcException #350

Fazer01 opened this issue Oct 23, 2024 · 1 comment
Labels

Comments

@Fazer01
Copy link

Fazer01 commented Oct 23, 2024

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

@Fazer01
Copy link
Author

Fazer01 commented Dec 4, 2024

Anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants