Closed lamelyan closed 1 month ago
Full stack trace:
fail: System.Guid[0] Invocation failed! System.InvalidOperationException: This operation is not allowed with Wolverine is bootstrapped in MediatorOnly mode at Wolverine.Runtime.MessageBus.assertNotMediatorOnly() in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 36 at Wolverine.Runtime.MessageBus.PublishAsync[T](T message, DeliveryOptions options) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 161 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 370 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 354 at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Wolverine.Runtime.Handlers.Executor.InvokeAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 202 fail: System.Guid[0] Inline invocation of 01906f7b-05b5-4711-92d2-a6180dbf6e05 failed System.InvalidOperationException: This operation is not allowed with Wolverine is bootstrapped in MediatorOnly mode at Wolverine.Runtime.MessageBus.assertNotMediatorOnly() in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 36 at Wolverine.Runtime.MessageBus.PublishAsync[T](T message, DeliveryOptions options) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 161 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 370 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 354 at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Wolverine.Runtime.Handlers.Executor.InvokeAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 202 at Wolverine.Runtime.Handlers.Executor.InvokeAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 212 at Wolverine.Runtime.Handlers.Executor.InvokeInlineAsync(Envelope envelope, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 93 fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.InvalidOperationException: This operation is not allowed with Wolverine is bootstrapped in MediatorOnly mode at Wolverine.Runtime.MessageBus.assertNotMediatorOnly() in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 36 at Wolverine.Runtime.MessageBus.PublishAsync[T](T message, DeliveryOptions options) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageBus.cs:line 161 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 370 at Wolverine.Runtime.MessageContext.EnqueueCascadingAsync(Object message) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/MessageContext.cs:line 354 at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Internal.Generated.WolverineHandlers.GuidHandler418050186.HandleAsync(MessageContext context, CancellationToken cancellation) at Wolverine.Runtime.Handlers.Executor.InvokeAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 202 at Wolverine.Runtime.Handlers.Executor.InvokeAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 212 at Wolverine.Runtime.Handlers.Executor.InvokeInlineAsync(Envelope envelope, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 93 at Wolverine.Runtime.Handlers.Executor.InvokeAsync[T](Object message, MessageBus bus, CancellationToken cancellation, Nullable`1 timeout, String tenantId) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 129 at NorthStar.Server.Controllers.ProjectController.Get(IMessageBus bus) in /Users/lamelyan/repos/NorthStar/northstar.server/NorthStar.API/Controllers/ProjectController.cs:line 30 at lambda_method89(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
gLogged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker. g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker. Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g gAwaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker. g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker. Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at NorthStar.Server.Middleware.Users.UserIdFromTokenMiddleware.InvokeAsync(HttpContext context) in /Users/lamelyan/repos/NorthStar/northstar.server/NorthStar.API/Middleware/Users/UserIdFromTokenMiddleware.cs:line 37 at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)g
It looks like this is the line that does this check. However, it's in the method PublishAsync
method. I'm not calling it directly...
Meh, I see it. Easy fix when I can get there. Thanks for the repro!
@lamelyan Sorry for the delay, finally got back to wolverine fixes after a vacation. Fix coming out soon.
Just to let you know though, I'm not recommending the "Wolverine as MediatR replacement" approach except as an intermediate step. I think you can get a lot simpler code by going all Wolverine.HTTP. And wolverine is a touch weak with the InvokeAsync
Describe the bug Trying to move query logic into handlers. I run the following code and get a message:
It sounds like, I can't call IMessage InvokeAsync in MediatorOnly mode...
Here is my set up.
Given this handler:
when called from the controller:
I get the following error message:
In Program.cs it's wired like so: