MediatR icon indicating copy to clipboard operation
MediatR copied to clipboard

Missing handler only in kubernetes

Open ghost opened this issue 4 years ago • 1 comments

The project that I'm experiencing this with can be found here: https://gitlab.com/letskeepitcheap/worker

I get the following error Error constructing handler for request of type MediatR.IRequestHandler`2[Worker.GetDueTransactionsQuery,System.Collections.Generic.IEnumerable`1[Worker.LedgerEntry]]. Register your handlers with the container. See the samples in GitHub for examples. for one of the two BackgroundServices.

I run a little kubernetes cluster on a VM for running some of my code, and this exception only occurs when this application is run in the cluster. I don't get the error when I run the exact same code locally (via command line) nor if I build the container and run it on my personal computer (and everything executes as I'd expect).

Let me know if I should provide more information.

I don't have time to dog into the MediatR code right now; I might try to figure this out later if I have time, though.

ghost avatar Sep 07 '21 21:09 ghost

Have you been able to resolve this now?

benjaminjnr avatar Apr 23 '22 20:04 benjaminjnr

I have the same problem. I still couldn't solve

cmssantos avatar Sep 22 '22 16:09 cmssantos

It might be due to this bug in the .NET Core DI library:

https://github.com/dotnet/runtime/issues/65145

You can verify locally in the steps in that issue.

jbogard avatar Sep 22 '22 16:09 jbogard

It might be due to this bug in the .NET Core DI library:

dotnet/runtime#65145

You can verify locally in the steps in that issue.

Thank you for reply.

Not my case, I use the repository in command hadler, and in docker I have to pass the database service name defined in docker-compose. I was passing localhost instead of "mssql" for example. This was interfering with mediatR service registry.

Work's now.

cmssantos avatar Sep 22 '22 18:09 cmssantos