i have a kafka topic where i am trying to post msg through nodejs , but getting error as " self-signed certificate in certificate chain" , but i want to attach my own client certificate which i have with me , to verify the request with the certificate ,by setting NODE_TLS_REJECT_UNAUTHORIZED to 0 was able to work for my NodeJS testing, but can you tell me how to attach certificate as for prod env it is needed?
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 1;
process.env['KAFKAJS_NO_PARTITIONER_WARNING']=1;
process.env['NODE_EXTRA_CA_CERTS']='/certy/ClientRootCA.pem'
try {
const kafka = new Kafka({
clientId: username,
brokers: brokers,
ssl: {
cert: fs.readFileSync('cert.crt', 'utf-8'),
// rejectUnauthorized: false,
ca: fs.readFileSync('ClientRootCA.pem', 'utf-8')
},
sasl: {
mechanism: 'scram-sha-512', // scram-sha-256 or scram-sha-512
username: username,
password: password
}
})
this is the code where i am trying to attach certificate of my client