Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
j-kressdesigns opened this issue Jul 13, 2023 · 0 comments

Comments

@j-kressdesigns
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant