NestJS gRPC Cant connect to microservice
When i trying to call some method from service im getting “Error: 14 UNAVAILABLE: No connection established”
Code in some module:
imports: [
ClientsModule.register([
{
name: 'UsersService',
transport: Transport.GRPC,
options: {
url: 'localhost:50051',
package: 'users',
protoPath: 'path/to/proto',
}
}
])
],
Users microservice:
async function bootstrap() {
const app = await NestFactory.createMicroservice(
UsersModule,
{
transport: Transport.GRPC,
options: {
url: 'localhost:50051',
package: 'users',
protoPath: 'path/to/proto',
}
},
)
}
Full error
[Nest] 3644 - 12.06.2022, 22:11:54 ERROR [ExceptionsHandler] 14 UNAVAILABLE: No connection established
Error: 14 UNAVAILABLE: No connection established
at Object.callErrorFromStatus (C:\Users\123\Desktop\projects\syntx\api-gateway\node_modules\@grpc\grpc-js\src\call.ts:81:24)
at Object.onReceiveStatus (C:\Users\123\Desktop\projects\syntx\api-gateway\node_modules\@grpc\grpc-js\src\client.ts:351:36)
at Object.onReceiveStatus (C:\Users\123\Desktop\projects\syntx\api-gateway\node_modules\@grpc\grpc-js\src\client-interceptors.ts:462:34)
at Object.onReceiveStatus (C:\Users\123\Desktop\projects\syntx\api-gateway\node_modules\@grpc\grpc-js\src\client-interceptors.ts:424:48)
at C:\Users\123\Desktop\projects\syntx\api-gateway\node_modules\@grpc\grpc-js\src\call-stream.ts:330:24
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Read more here: Source link