Description
we need to use mTLS authentication to a https endpoint with certificate and key when submitting cloud events.
We got the following error:
"The "options.agent" property must be one of type Agent-like Object, undefined, or false."
when using the following code:
var options = { method: "POST", url: requestUrl, httpsAgent: new https.Agent({ cert: fs.readFileSync(cf_cert), key: fs.readFileSync(cf_key) }) };
var binding = new cloudeventsSDK.StructuredHTTPEmitter(options); binding.emit(ce) .then(response => { callback(null); }).catch(err => { callback(err); });
emitter_structured.js (possibly in other emitters as well) line #6 & line#23 causing the issue, it assumes the configuration is a JSON object, but in the case of httpsAgent, the underlying module requires httpsAgent attribute of type 'Agent-like' object.