diff --git a/packages/microservices/server/server-grpc.ts b/packages/microservices/server/server-grpc.ts index 77747ff50a9..344a893f1f1 100644 --- a/packages/microservices/server/server-grpc.ts +++ b/packages/microservices/server/server-grpc.ts @@ -381,7 +381,13 @@ export class ServerGrpc extends Server implements CustomTransportStrategy { const handler = methodHandler(req.asObservable(), call.metadata, call); const res = this.transformToObservable(await handler); if (isResponseStream) { - await this.writeObservableToGrpc(res, call); + try { + await this.writeObservableToGrpc(res, call); + } + catch (err) { + call.emit('error', err); + return; + } } else { const response = await lastValueFrom( res.pipe(