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

Using logger object before it's been initialised, when invalid combination of command line parameters #567

Closed
mountaindude opened this issue Oct 5, 2022 · 0 comments · Fixed by #569
Assignees
Labels
Milestone

Comments

@mountaindude
Copy link
Collaborator

Here the account name First NR account didn't have any double quotes around it, leading to an error condition.
But the logger object hadn't been initialised yet, resulting in an error.

bash

~/code/butler/src$ /home/goran/.nvm/versions/node/v18.4.0/bin/node ./butler.js -c config/production.yaml --new-relic-account-name First NR account --new-relic-account-id ACCOUNT --new-relic-api-key KEY
/home/goran/code/butler/src/globals.js:123
    logger.error('Incorrect command line parameters: Number of New Relic account names/IDs/API keys must match.');
    ^

ReferenceError: Cannot access 'logger' before initialization
    at Object.<anonymous> (/home/goran/code/butler/src/globals.js:123:5)
    at Module._compile (node:internal/modules/cjs/loader:1112:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/goran/code/butler/src/butler.js:6:17)
    at Module._compile (node:internal/modules/cjs/loader:1112:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant