Kraken JS: mogran deprecated undefined format: specify a format

1.6k Views Asked by At

Tue, 29 Jul 2014 21:52:17 GMT morgan deprecated undefined format: specify a format at node_modules\kraken-js\node_modules\meddleware\index.js:98:20 Tue, 29 Jul 2014 21:52:17 GMT morgan deprecated default format: use combined format at node_modules\kraken-js\node_modules\meddleware\index.js:98:20

Right after installing a fresh kraken js project, this error will be logged twice on starting an app. It does not kill the app, but it is pretty annoying to have errors without having even done anything.

Searches for this problem only revealed the morgan releases page where they deprecated empty/default format.

The actual calling of the method is done in node_modules\kraken-js\node_modules\meddleware\index.js on line 98 (obviously), but I'm honestly not sure what the arguments should be instead of what they are now.

So, has anybody encountered/fixed this yet?

2

There are 2 best solutions below

0
On BEST ANSWER

A cleaner solution would be to configure morgan in your application directly. You can do this by adding the following block to your middleware config:

"logger": {
  "module": {
    "name": "morgan",
    "arguments": [
      "dev"
    ]
  }
}

I use the 'dev' format in development and the 'combined' format otherwise. Optionally, you can add an options object as another element in the arguments array that will accept any Morgan options as listed on its repository's README.

0
On

So on line 97 of kraken-js/node_modules/meddleware/index.js, I changed this line:

args = thing.isArray(config['arguments']) ? config['arguments'] : [];

to this:

args = thing.isArray(config['arguments']) ? config['arguments'] : ['combined'];

and it no longer throws the error. The problem is I don't think this is the correct solution, but it seems to work. The app is clearly listening to the port and responds as I expect it to. So if somebody finds a better solution, please let me know. Otherwise, this seems to be the current answer.