diff --git a/lib/resty/pubsub/producer.lua b/lib/resty/pubsub/producer.lua index a228a69..2e79ef5 100644 --- a/lib/resty/pubsub/producer.lua +++ b/lib/resty/pubsub/producer.lua @@ -165,8 +165,13 @@ function _M.send(self, message, attributes, ordering_key) attributes = attributes } - if type(ordering_key) == "string" then - body_message['ordering_key'] = ordering_key + + if ordering_key ~= nil then + if type(ordering_key) == "string" then + body_message['ordering_key'] = ordering_key + else + ngx.log(ngx.DEBUG, "Ordering key must be String hence dropping it ", ordering_key) + end end if self.ring_buffer == nil then