diff --git a/lib/producer_record.js b/lib/producer_record.js index 214e647..df2a14a 100644 --- a/lib/producer_record.js +++ b/lib/producer_record.js @@ -36,7 +36,7 @@ ProducerRecord.prototype.validate = function validate() { if (typeof self.value !== 'string' && !Buffer.isBuffer(self.value)) { return new Error('ProducerRecord value is neither string nor byte array'); } - if (self.key !== undefined && typeof self.value !== 'string') { + if (self.key !== undefined && typeof self.key !== 'string' && !Buffer.isBuffer(self.key)) { return new Error('ProducerRecord value is neither string'); } return null;