#[RabbitMQ Microservice] No matching message handler defined in the remote service. Every 2 requests

1 messages · Page 1 of 1 (latest)

bleak slate
#

Hello guys,

Now I'm implementing 2 monorepo microservices, communicated each other with RabbitMQ and handle requests with Graphql

#

In every 2 requests from reproduction step below cause the error like this

{
    "errors": [
        {
            "message": "Unexpected error value: \"There is no matching message handler defined in the remote service.\"",
            "locations": [
                {
                    "line": 2,
                    "column": 2
                }
            ],
            "path": [
                "itemInventory1List"
            ],
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "exception": {
                    "name": "NonErrorThrown",
                    "thrownValue": "There is no matching message handler defined in the remote service.",
                    "stacktrace": [
                        "NonErrorThrown: Unexpected error value: \"There is no matching message handler defined in the remote service.\"",
                        "    at toError (/usr/src/app/node_modules/graphql/jsutils/toError.js:16:7)",
                        "    at locatedError (/usr/src/app/node_modules/graphql/error/locatedError.js:20:46)",
                        "    at /usr/src/app/node_modules/graphql/execution/execute.js:503:54",
                        "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
                        "    at async Promise.all (index 0)",
                        "    at execute (/usr/src/app/node_modules/apollo-server-core/src/requestPipeline.ts:501:14)",
                        "    at processGraphQLRequest (/usr/src/app/node_modules/apollo-server-core/src/requestPipeline.ts:407:22)",
                        "    at processHTTPRequest (/usr/src/app/node_modules/apollo-server-core/src/runHttpQuery.ts:436:24)"
                    ]
                }
            }
        }
    ],
    "data": {
        "itemInventory1List": null
    }
}
#

Is there anything I'm wrong or is this a new bug?

Thank you.

Minimum reproduction code
https://github.com/kanottonp/nestjs-rabbitmq-bug-reproducer

Steps to reproduce

npm install
npm run start:dev inventory-1
npm run start:dev inventory-2

and send Graphql query to 'localhost:3001/graphql' repeatedly as

query {
    itemInventory1List {
        id
        name
        description
    }
}

the error will be showed in every 2 requests.

GitHub

Contribute to kanottonp/nestjs-rabbitmq-bug-reproducer development by creating an account on GitHub.

vagrant escarp
#

Hi, i have a similar issue (but using Event instead of Message) and managed to make it work by following this answer (the queue part, i didn't need to specify the event bus) on a similar github issue : https://github.com/nestjs/nest/issues/8887#issuecomment-1008272323
The problem seems to happen when a microservice is both a producer and a consumer on the same queue.
No problem anymore when using different queues on each microservice, for example for "bidirectional communication" between microservice 1 and 2 :

  • microservice 1 emits to queue1
  • microservice 2 emits to queue2
  • microservice 1 consumes queue2
  • microservice 2 consumes queue1
    I also tried to emit different messages on 2 different queues from microservice 1 (with 2 instances of client proxies), and "consume both queues" on microservice2 (with 2 microservices instances too) : it works too.
    I understand that's a lot of work if there are many microservices, but at least, it works directly without errors...
GitHub

Is there an existing issue for this? I have searched the existing issues Current behavior Currently every other request works, and every other is being marked as "Unroutable (drop)&quo...