1
votes

I'm upgrading an ember/ember-cli application to ember 1.12. I'm now receiving the following deprecation warning:

DEPRECATION: `lookup` was called on a Registry. The `initializer` API no longer receives a container, 
and you should use an `instanceInitializer` to look up objects from the container. 
See http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers for more details.

Looking at the example, I see that things like the following:

App.initializer({
  name: "clock",

  initialize: function(container, application) {
    application.register("clock:main", Clock);
    var clock = container.lookup("clock:main");
    clock.setStartTime(Date.now());
  }
});

Should be changed to:

App.initializer({
  name: "clock",

  initialize: function(registry, application) {
    application.register("clock:main", Clock);
  }
});

App.instanceInitializer({
  name: "clock",

  initialize: function(instance) {
    var clock = instance.container.lookup("clock:main");
    clock.setStartTime(Date.now());
  }
});

But I don't have anything like that code at all. What in an ember-cli 0.2.5 application would cause this warning?

2

2 Answers

2
votes

Ember Data is most likely causing the issue, I saw it yesterday on one of my apps, you can checkout the stack trace and likely see who the culprit is.

https://github.com/emberjs/data/issues/3051

enter image description here

2
votes

This issue was fixed in ember-data v1.0.0-beta.19, I changed the version of ember-data in my bower.json file using v1.0.0-beta.19, then I ran bower install, and finally run my ember application. The deprecated warning messages were gone.