const methodClient = new MethodClient(authenticationProvider);
methodClient.setOptions({ ca });
However, MqttBase.setOptions does not merge _options, so calling setOptions method in the callback of ModuleClient.fromEnvironment will overwrite the ca option, resulting in a certificate error.
Context
Description of the issue
The
ca
option is set in _fromEnvironmentEdge function.However,
MqttBase.setOptions
does not merge_options
, so callingsetOptions
method in the callback ofModuleClient.fromEnvironment
will overwrite theca
option, resulting in a certificate error.Code sample exhibiting the issue
Console log of the issue
Workaround
Get the current options from
client._methodClient._options
(there is notgetOptions
method!) and merge them by yourself.