fix(microservices): fix get service from multi package grpc client error

Calling getService of grpc clients with multiple packages shows error
'Channel third argument (options) must be an object with string keys
and integer or string values'. Which is caused by passing options with
GrpcOptions['options'] format to grpc client's constructor.
As the options are transformed and kept in 'maxMessageLengthOptions' and
'keepaliveOptions', we can remove and skip passing ClientGrpcProxy's
options to node grpc Client's constructor.
This commit is contained in:
danielscw
2020-03-29 15:40:50 +08:00
parent 6135b623a0
commit 0b38029830

View File

@@ -89,16 +89,10 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
}
const keepaliveOptions = this.getKeepaliveOptions();
const options: Record<string, unknown> = isObject(this.options)
? {
...this.options,
...maxMessageLengthOptions,
...keepaliveOptions,
loader: '',
}
: {
...maxMessageLengthOptions,
};
const options: Record<string, string | number> = {
...maxMessageLengthOptions,
...keepaliveOptions,
};
const credentials =
options.credentials || grpcPackage.credentials.createInsecure();