gRPC Microservice: Unhandled promise rejection
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I’m creating a gRPC microservice based on docs V5
, for testing the new feature for grpc microservices. I defined in the controller the grpc route using the GrpcRoute
decorator.
When I try to handle the gRPC method from a gRPC client, show the next warning and not resolve the request:
(node:317) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: rxjs_1.of is not a function
Expected behavior
The grpc method should resolve the request.
Minimal reproduction of the problem with instructions
import 'dotenv/config'
import { join } from 'path'
import { Logger } from '@nestjs/common'
import { Transport } from '@nestjs/microservices'
import { NestFactory } from '@nestjs/core'
import { ApplicationModule } from './modules/ApplicationModule'
async function bootstrap () {
const port = Number(process.env.PORT) || 50051
const app = await NestFactory.createMicroservice(ApplicationModule, {
transport: Transport.GRPC,
options: {
url: `0.0.0.0:${port}`,
package: 'article',
protoPath: join(__dirname, './Article.proto')
}
})
await app.listenAsync()
}
bootstrap()
import { Controller } from '@nestjs/common'
import { GrpcRoute } from '@nestjs/microservices'
import { EmptyInterface } from '../interfaces/EmptyInterface'
import { ArticleResponseInterface } from '../interfaces/ArticleResponseInterface'
@Controller()
export class ArticleController {
@GrpcRoute('Article', 'CreateArticle')
createArticle (data: EmptyInterface, metadata: any): ArticleResponseInterface {
const postId = '40050'
return { postId }
}
}
What is the motivation / use case for changing the behavior?
The exposed grpc microservice should resolve the specified routes on controller based on protofile. Without expose a HTTP Serve, only GRPC Serve.
Environment
Nest version: 5.0.0-rc.2
For Tooling issues:
- Node version: v8.4.0
- Platform: Mac
Others:
Yarn: 1.5.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Method implement error between 2 grpc microservices in nodejs
I have 2 gRPC microservices. I want to use one of these 2 microservices as a client and the other as a server...
Read more >gRPC - Microservices - A progressive Node.js framework
gRPC is a modern, open source, high performance RPC framework that can run in any environment. It can efficiently connect services in and...
Read more >Error handling in gRPC with public RESTFul API - Techdozo
Error message propagation from a gRPC server to a client that exposes RESTful web API can be done with google.rpc.Status APIs.
Read more >Promise-based circuit breaking for gRPC in Node.js - ITNEXT
This is used internally by the createRpcCommand function, which “promisifies” the command — a functionality that is missing in the base library.
Read more >Building scalable microservices with gRPC - Bugsnag
Error conditions - Having a well-defined set of error codes makes it easier to communicate issues consistently. Documentation - The service API ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed locally, I’ll push updated docs soon.
Actually, leaving this opened to do not forget about updating the migration guide.