hapijs / good

hapi process monitoring
Other
525 stars 160 forks source link

Glue + Good console not working #561

Closed vforv closed 6 years ago

vforv commented 7 years ago

Here is my config.json code:

{
    "connections": [
        {
            "port": 3000
        }
    ],
    "registrations": [
        {
            "plugin": "./plugins/db"
        },
        {
            "plugin": "good",
            "options": {
                "reporters": {
                    "console": [
                        {
                            "module": "good-squeeze",
                            "name": "Squeeze",
                            "args": [
                                {
                                    "log": "*",
                                    "response": "*"
                                }
                            ]
                        },
                        {
                            "module": "good-console"
                        },
                        "stdout"
                    ]
                }
            }
        },
        {
            "plugin": "./routes/bookmarks"
        },
        {
            "plugin": "blipp"
        }
    ]
}

And server.js:

'use strict';

const Hapi = require('hapi');
const Glue = require('glue');

const manifest = require('./config.json');

const options = {
    relativeTo: __dirname
}

Glue.compose(manifest, options, (err, server) => {
    if (err) {
        throw err
    }

    server.start((err) => {
        if (err) {
            throw err
        }

        console.log(`Server is running at ${server.info.uri}`)
    });
})

The error I get:

/home/master/Documents/Hapi/starter/node_modules/hoek/lib/index.js:736
    throw new Error(msgs.join(' ') || 'Unknown error');
    ^

Error: Invalid register options {
  "reporters" [1]: {
    "console": [
      {
        "module": "good-squeeze",
        "name": "Squeeze",
        "args": [
          {
            "log": "*",

Any solution for this?

arb commented 7 years ago

What versions? Also, this would probably get faster responses in the glue repository as the error seems to be coming from there. I've personally never used glue.

vforv commented 7 years ago

here are versions....

    "glue": "^4.1.0",
    "good": "^7.2.0",
arb commented 7 years ago

Do those options work with good directly? The look ok to me.

csrl commented 6 years ago

As the error message says "Invalid register options". You want to pass those as "plugin options" instead. See the hapi register API for the difference - https://hapijs.com/api#serverregisterplugins-options-callback

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.