diff --git a/lib/model-builder.js b/lib/model-builder.js index 60758ddf..a688004d 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -161,6 +161,9 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett }; // mix in EventEmitter (don't inherit from) var events = new EventEmitter(); + // The model can have more than 10 listeners for lazy relationship setup + // See https://github.com/strongloop/loopback/issues/404 + events.setMaxListeners(32); for (var f in EventEmitter.prototype) { if (typeof EventEmitter.prototype[f] === 'function') { ModelClass[f] = EventEmitter.prototype[f].bind(events);