-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TypeError When Using @Paginate() with @MessagePattern() (@nestjs/microservices) #894
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #894 +/- ##
=======================================
Coverage 97.85% 97.85%
=======================================
Files 16 16
Lines 652 653 +1
Branches 190 192 +2
=======================================
+ Hits 638 639 +1
Misses 14 14 ☔ View full report in Codecov by Sentry. |
I'm unfamiliar with RPC, could you explain why |
While using I'm not really interested in contributing or finding other, better solutions. This fix works perfectly in my project, and I just wanted to highlight the issue for maintainers and fellow gamers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished OP's PR.
(Sort of) added (untested) WS & RCP support, assuming that their query will be in getData()
.
@ppetzold could you have a look? |
@ppetzold ping :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicely done 🚀
🎉 This PR is included in version 9.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Problem
Currently, when the
@Paginate()
decorator is used alongside the@MessagePattern()
decorator within a NestJS microservice, an error is thrown. This occurs becauseExecutionContextHost.switchToHttp().getRequest()
does not contain aquery
key in 'rpc' mode, leading toundefined
being returned and causing the followingTypeError
:This error specifically arises due to the incompatibility of the
@Paginate()
decorator expecting HTTP request objects in an environment where such objects are not available.