alertlogic/ehub-collector

Javascript issue in ehub_collector.js attempting to call .map() function on an object

Opened this issue · 0 comments

const eventHubMessages = rawMessages.map(message => {

I attempted to debug and run my installation of ehub-collector by running npm run local-ehub-general and received error:

TypeError: rawMessages.map is not a function
at module.exports (my-project-directory\common\ehub_collector.js:38:42)

This happens because map() method is defined on Array, and does not exist in Object. This worked:

const eventHubMessages = Array.isArray(rawMessages) ? rawMessages.map(message => {
...
}) : [];

Function worked fine after this change and my logs are ingested properly now. Is there an expectation that rawMessages might be an Object instead of an Array?