elsa-workflows / elsa-workflows/elsa-core

Workflow Cancellation not working in Elsa Studio

Open
#7,034 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
I cannot cancel a workflow via the Elsa Studio. I'm running Elsa 3.5.1 with Multitenant feature. Cancelling the workflow will return a 200 OK to the studio but

## Steps to Reproduce
- Setup Elsa using multi tenancy
- Cancel a workflow from the studio

## Expected Behavior
The workflow should be cancelled.

## Actual Behavior
The request returns 200 OK, but the background tasks fails.

## Log Output

```
Elsa.Mediator.HostedServices.BackgroundCommandSenderHostedService[0] An unhandled exception occurred while processing the queue System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. (Workflow instance not found.) --->
Elsa.Workflows.Runtime.Exceptions.WorkflowInstanceNotFoundException: Workflow instance not found. at Elsa.Workflows.Runtime.LocalWorkflowClient.GetWorkflowInstanceAsync(CancellationToken cancellationToken) at Elsa.Workflows.Runtime.LocalWorkflowClient.CancelAsync(CancellationToken cancellationToken) at
Elsa.Workflows.Runtime.Handlers.CancelWorkflowsCommandHandler.HandleAsync(CancelWorkflowsCommand command, CancellationToken cancellationToken) at
Elsa.Mediator.CommandStrategies.DefaultStrategy.ExecuteAsync[TResult](CommandStrategyContext context) --- End of inner exception stack trace --- at
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at
System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at
InvokeStub_Task`1.get_Result(Object, Object, IntPtr*) at
System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at
Elsa.Mediator.Middleware.Command.Components.CommandHandlerInvokerMiddleware.InvokeAsync(CommandContext context) at
Elsa.Tenants.Mediator.Middleware.TenantPropagatingMiddleware.InvokeAsync(CommandContext context) at Elsa.Mediator.Middleware.Command.CommandPipeline.InvokeAsync(CommandContext context) at
Elsa.Mediator.Services.DefaultMediator.SendAsync(ICommand command, ICommandStrategy strategy, IDictionary`2 headers, CancellationToken cancellationToken) at
Elsa.Mediator.HostedServices.BackgroundCommandSenderHostedService.ReadOutputAsync(Channel`1 output, CancellationToken cancellationToken)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.