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

Incompatible with mongoose objects #47

Open
zoellner opened this issue Aug 15, 2016 · 1 comment
Open

Incompatible with mongoose objects #47

zoellner opened this issue Aug 15, 2016 · 1 comment

Comments

@zoellner
Copy link

This transporter is incompatible with mongoose objects. A minimal config to reproduce is below.
Tested with winston@2.2.0, winston-loggly@1.3.1, mongoose@4.5.9
This is probably the same error as in winstonjs/winston#100

The stack trace end in:

RangeError: Maximum call stack size exceeded

at Object.exports.clone (/Users/test/test-winston/node_modules/winston/lib/winston/common.js:110:52)
[... many more levels of common.js:110:52]
at Object.exports.clone (/Users/test/test-winston/node_modules/winston/lib/winston/common.js:110:52)
at Object.exports.clone (/Users/test/test-winston/node_modules/winston/lib/winston/common.js:110:52)
at Object.exports.clone (/Users/test/test-winston/node_modules/winston/lib/winston/common.js:110:52)
at Loggly.log (/Users/test/test-winston/node_modules/winston-loggly/lib/winston-loggly.js:102:25)
at transportLog (/Users/test/test-winston/node_modules/winston/lib/winston/logger.js:228:15)
at /Users/test/test-winston/node_modules/winston/node_modules/async/lib/async.js:157:13
at _each (/Users/test/test-winston/node_modules/winston/node_modules/async/lib/async.js:57:9)
at Object.async.each (/Users/test/test-winston/node_modules/winston/node_modules/async/lib/async.js:156:9)
at Logger.log (/Users/test/test-winston/node_modules/winston/lib/winston/logger.js:240:9)
at target.(anonymous function) [as info] (/Users/test/test-winston/node_modules/winston/lib/winston/common.js:54:18)
at /Users/test/test-winston/logglyTest.js:42:12
at Query.<anonymous> (/Users/test/test-winston/node_modules/mongoose/lib/query.js:2236:28)
at /Users/test/test-winston/node_modules/kareem/index.js:259:21
at /Users/test/test-winston/node_modules/kareem/index.js:127:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

The code to reproduce:

'use strict';

Error.stackTraceLimit = Infinity;

var winston = require('winston');
require('winston-loggly');
var winstonConfig = {
  Loggly: {
    level: 'silly',
    subdomain: process.env.SUBDOMAIN,
    inputToken: process.env.TOKEN,
    tags: ['NodeJS'],
    json: true,
    stripColors: true
  }
};

winston.loggers.add('default', winstonConfig);

var logger = winston.loggers.get('default');

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test-winston-loggly', {db: { safe: true}});

var ModelSchema = new mongoose.Schema({
  field1: String
});

var Model = mongoose.model('Model', ModelSchema);

Model.create({field1: 'test'}, function(err) {
  if (err) {
    console.error(err);
    process.exit(1);
  }
  Model.findOne({}).exec(function(err, doc) {
    if (err) {
      console.error(err);
      process.exit(1);
    }
    console.log('expecting log of document: ', JSON.stringify(doc, null, 2));
    logger.info('test log', {doc: doc});
  });
});
@mansona
Copy link

mansona commented Oct 31, 2016

We've just hit this error, any chance of getting the Decycle implementation merged and released?

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

No branches or pull requests

2 participants