Deprecation: must have an `isServiceFactory` property set to true


#1

Is anyone able to help me work out where this deprecation has come from? It appears in the Ember Inspector Deprecations section.

Even if I click on the last line of the callstack, best I can tell it comes from within Ember itself. So it’s an Ember bug and I just report it? I just need someone more experienced to confirm this is an ember bug.

Ember Inspector (Deprecation Trace): In Ember 2.0 service factories must have an `isServiceFactory` property set to true. You registered (unknown mixin) as a service factory. Either add the `isServiceFactory` property to this factory or extend from Ember.Service.

    at validateType (http://localhost:4200/assets/vendor.js:15823:13)
    at exports.default._emberRuntimeSystemObject.default.extend.resolve (http://localhost:4200/assets/vendor.js:15511:56)
    at Object.resolve [as resolver] (http://localhost:4200/assets/vendor.js:15263:23)
    at resolve (http://localhost:4200/assets/vendor.js:12753:29)
    at Object.Registry.resolve (http://localhost:4200/assets/vendor.js:12316:21)
    at factoryFor (http://localhost:4200/assets/vendor.js:11909:28)
    at instantiate (http://localhost:4200/assets/vendor.js:11967:19)
    at lookup (http://localhost:4200/assets/vendor.js:11865:17)
    at Object.Container.lookup (http://localhost:4200/assets/vendor.js:11797:14)

The last line there links to this code which appears to be part of ember:

lookup: function (fullName, options) {
  _emberMetalCore.default.assert('fullName must be a proper full name', this._registry.validateFullName(fullName));
  return lookup(this, this._registry.normalize(fullName), options);
},

#2

Nevermind. I found that this stack trace was being limited to 10 lines.

Adding this to the top of app/app.js fixed it.

Error.stackTraceLimit=100;

I can now see all lines of the trace, and after some digging found that the deprecation was being caused by Ember Validation.

I hope this helps someone else.


#3

@jeremytm can you post a small example snippet of actual code that triggered this issue? And what you changed to resolve it?

I have the same error and looking to refactor. But need to better understand it.


#4

This is the change that the ember-validations team made which fixes the issue:

It’s not available in any releases yet, but I just changed their code locally to reflect this change to get rid of the deprecation until they release it.


#5

Thanks for the example. That really helped me understand what was going on. The deprecation warning is could use an "E.g. Ember.Object.extend... should be Ember.Service.extend" or something like that.