Closed julien-sarazin closed 1 year ago
Would you like to create a PR for this issue?
Sure thing. It would be my first, would you suggest any reading other than the contributing.md?
Going through the contribution file should be enough! Otherwise, look at scripts defined in the package.json file, they should be pretty self explanatory (build, test, integration tests)
Let's track this here https://github.com/nestjs/nest/pull/11437
Is there an existing issue for this?
Current behavior
In a gRPC controller, when using an interceptor that executes async methods, the payload returned by the server is empty.
Minimum reproduction code
https://github.com/julien-sarazin/nest-grpc-interceptor-issue
Steps to reproduce
npm i
npm run start:dev
GET http://localhost:3333
See payload is properly filledSame query via gRPC request
localhost:50033 ItemService.First()
See payload is properly filledUncomment app.controller.ts (line 22)
Same query via gRPC request
localhost:50033 ItemService.First()
see payload incorrectExpected behavior
Expecting the payload to be the same with or without the interceptor, to match the behavior of classic HTTP controller.
Package
Other package
No response
NestJS version
9.4.0
Packages versions
Node.js version
18.15.0
In which operating systems have you tested?
Other
Looking at https://github.com/nestjs/nest/blob/0d8c618c76af29cecf86d4a6f0a7ab8cb7471f0a/packages/microservices/server/server-grpc.ts#L220
making the subscriber async resolve the issue :