hapijs / good

hapi process monitoring
Other
525 stars 161 forks source link

Invalid monitorOptions options child "reporters" fails because ["reporters" must be an array] #480

Closed nerdpad closed 8 years ago

nerdpad commented 8 years ago

I am getting the following error when trying to use Good:

Error:

/Users/myuser/code/orc/orccommon/node_modules/good/node_modules/hoek/lib/index.js:731
    throw new Error(msgs.join(' ') || 'Unknown error');
    ^

Error: Invalid monitorOptions options child "reporters" fails because ["reporters" must be an array]
    at Object.exports.assert (/Users/myuser/code/orc/orccommon/node_modules/good/node_modules/hoek/lib/index.js:731:11)
    at Object.exports.assert (/Users/myuser/code/orc/orccommon/node_modules/good/lib/schema.js:11:10)
    at new module.exports.internals.Monitor (/Users/myuser/code/orc/orccommon/node_modules/good/lib/monitor.js:72:12)
    at Object.exports.register (/Users/myuser/code/orc/orccommon/node_modules/good/lib/index.js:10:19)
    at Object.target [as register] (/Users/myuser/code/orc/orccommon/node_modules/hapi/node_modules/joi/lib/object.js:79:30)
    at each (/Users/myuser/code/orc/orccommon/node_modules/hapi/lib/plugin.js:317:14)
    at iterate (/Users/myuser/code/orc/orccommon/node_modules/hapi/node_modules/items/lib/index.js:36:13)
    at Object.exports.serial (/Users/myuser/code/orc/orccommon/node_modules/hapi/node_modules/items/lib/index.js:39:9)
    at module.exports.internals.Plugin.parent.auth.internals.Plugin.register.each 
    [as register] (/Users/myuser/code/orc/orccommon/node_modules/hapi/lib/plugin.js:320:11)
    at module.exports.options (/Users/myuser/code/orc/orccommon/server/ext/good.js:76:20)
    at module.exports (/Users/myuser/code/orc/orccommon/server/ext/index.js:44:5)
    at module.exports.options (/Users/myuser/code/orc/orccommon/server/index.js:88:5)
    at Object.<anonymous> (/Users/myuser/code/orc/orccommon/samples/server.js:26:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

As per the documentation reporters should be an object. I don't understand why is it complaining about it not being an array?

My Code:

Good Options:

const options = {
        includes: {
            request: ['headers', 'payload'],
            response: ['payload']
        },
        ops: {
            config: {
                server
            },
            interval: 1000
        },
        reporters: {
            bunyan: [{
                module: 'good-bunyan',
                args: [
                    // events
                    {
                        ops: '*',
                        response: '*',
                        log: '*',
                        error: '*',
                        request: '*'
                    },
                    // config
                    {
                        logger
                    }
                ]
            }]
        }
    };

Versions:

"good": "^6.6.3",
"good-bunyan": "^0.1.2",
"hapi": "^13.3.0"
mtharrison commented 8 years ago

You're probably using version 6.x.x so you'll want to consult the docs for that version: https://github.com/hapijs/good/blob/v6.6.3/README.md or on npm.

nerdpad commented 8 years ago

@mtharrison Now that makes sense. Thank you for the blazing fast response.

mtharrison commented 8 years ago

You're welcome 😄

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.