You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Microservices with Kafka transport and try to throw a new error using throw new RpcException('Invalid credentials.');
I get
(node:27352)
UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
at Function.from (buffer.js:330:9)
at ServerKafka.assignErrorHeader (C:\Users\Barakat\Desktop\Projects\nestjs-micro-poc\node_modules\@nestjs\microservices\server\server-kafka.js:137:73)
at ServerKafka.sendMessage (C:\Users\Barakat\Desktop\Projects\nestjs-micro-poc\node_modules\@nestjs\microservices\server\server-kafka.js:119:14)
at C:\Users\Barakat\Desktop\Projects\nestjs-micro-poc\node_modules\@nestjs\microservices\server\server-kafka.js:81:31
at C:\Users\Barakat\Desktop\Projects\nestjs-micro-poc\node_modules\@nestjs\microservices\server\server.js:46:31
at processTicksAndRejections (internal/process/task_queues.js:79:11)
(node:27352) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:27352) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
If we add return instead of throw, it works as expected but the client observable isn't rejected
If we use throwError from rxjs instead of RPC exception it works fine but not as the documentation states
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current behavior
When using Microservices with Kafka transport and try to throw a new error using
throw new RpcException('Invalid credentials.');
I get
Minimum reproduction code
https://github.com/mustafa-barakat/nestjs-micro-rpc-exception
Steps to reproduce
docker-compose up
wait for the second 42, an client module is sending the message with schedule
Expected behavior
The client app should recieve an exception from Kafka as a response.
Or the observable be rejected but no observable is processed
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
8.0.0
Packages versions
Node.js version
14.17.5
In which operating systems have you tested?
Other
If we add return instead of throw, it works as expected but the client observable isn't rejected
If we use throwError from rxjs instead of RPC exception it works fine but not as the documentation states
The text was updated successfully, but these errors were encountered: