Debugging AxonServerRemoteQueryHandlingException

I am having some issue with understanding why my query handler is failing as the AxonServerRemoteQueryHandlingException returns no information about the exception that made it fail.

I am using Docker and Kubernetes and the application works as expected on the local environment (I even downloaded and tired with the production docker image to make sure).

I could expose the debug port on my cluster and connect my local debugger to it, eventually track down where the handler is throwing an exception, but I would probably have to either revert or make it easy to enable/disable (prob with env variables).

Other option would be to have more verbose logs… It would be nice if the exception was showing the previous exception.

Any advice on how to best accomplish this?

I recommend adding a MessageHandlerInterceptor<QueryMessage<?, ?> to the QueryGateway. You can add a try catch around the chain.proceed() and log the exceptions. see the docs https://docs.axoniq.io/reference-guide/configuring-infrastructure-components/messaging-concepts/message-intercepting

Hi Fábio and Sam,

Sam has an suggestion which you could traverse to get more information out of your exception, Fábio.
It will help in some scenarios, but not all I believe.

So in your scenario Fábio, you likely have two different application instances.
Now as these are distinct applications, they likely do not know about the exact format of the exception class.
Thus, Axon Server wraps it in a AxonServerRemoteQueryHandlingException.

This class does contain the actual contents of your exception, as a list of description.
You will have to traverse this yourself to figure out the exact stack trace which is being sent.

We’ve also marked that this API is not to friendly when it comes to sending exceptions back on queries (and commands too).
As such, we have a PR to allow you to send a QueryExecutionException containing your specific exception for example.

Hope this sheds some light on your situation!

Cheers,
Steven