Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

finding source of deprecation errors

Tags:

ember.js

I just upgraded to Ember 1.13.3 and Ember Data 1.13.5 and I am now seeing some deprecation warning messages. Specifically I see the following message:

Ember.keys is deprecated in favor of Object.keys

And along with that message I see the following trace:

 at Object._emberMetalCore.default.deprecateFunc [as keys] (http://localhost:3000/assets/frontend/vendor.self.js?body=1:16037:34)
        at Ember.DefaultResolver.extend.knownForType (http://localhost:3000/assets/frontend/vendor.self.js?body=1:68044:30)
        at Function.knownForType (http://localhost:3000/assets/frontend/vendor.self.js?body=1:15302:25)
        at Object.Registry.knownForType (http://localhost:3000/assets/frontend/vendor.self.js?body=1:12666:39)
        at Object.Registry.knownForType (http://localhost:3000/assets/frontend/vendor.self.js?body=1:12662:39)
        at Object.discoverKnownHelpers [as default] (http://localhost:3000/assets/frontend/vendor.self.js?body=1:20504:28)
        at new RenderEnv (http://localhost:3000/assets/frontend/vendor.self.js?body=1:20775:100)
        at Function.RenderEnv.build (http://localhost:3000/assets/frontend/vendor.self.js?body=1:20783:12)
        at Object.renderHTMLBarsBlock (http://localhost:3000/assets/frontend/vendor.self.js?body=1:20831:56)

I'm having difficulty understanding how I can track down the source of the deprecation warnings from the trace above.

like image 547
Francois Avatar asked Jul 08 '15 18:07

Francois


People also ask

What is a deprecation error?

Deprecation, in its programming sense, is the process of taking older code and marking it as no longer being useful within the codebase, usually because it has been superseded by newer code. The deprecated code is not immediately removed from the codebase because doing so may cause regression errors.

What is deprecation warning in Java?

Deprecation is a notification to library consumers that they should migrate code from a deprecated API. In the JDK, APIs have been deprecated for widely varying reasons, such as: The API is dangerous (for example, the Thread. stop method).


2 Answers

Almost all of these deprecation warnings are caused by Ember Data/HTMLBars, either jump up to later versions, or wait it out.

In your particular stack trace it never is referencing your code, just the vendor code. So it's either a third party add-on, or it's what I previously mentioned.

like image 78
Kingpin2k Avatar answered Oct 05 '22 12:10

Kingpin2k


I also upgraded to Ember 1.13.3 and Data 1.13.5 and got the Ember.keys deprecation message.

For me it was coming from load-initializers in the ember-load-initializers package.

It looks like this is fixed here https://github.com/ember-cli/ember-load-initializers/commit/78470bed646d76e176c1bc405796b3aeb01940f5 and is included in the ember-load-initializers 0.1.5 release.

It looks like this version made the Ember CLI 1.13.1 release so updating Ember CLI should get rid of the deprecation message in this instance.


Update I also continued to get deprecation messages and greping bower_components I couldn't see where from. Turned out they were coming from Ember Inspector itself (v1.8.3), so always worth a quick check there too. They've been fixed already (https://github.com/emberjs/ember-inspector/commit/31cc1331e14660084ba3702559afbdff67b973d6) so the next release should remove the rest.

like image 37
Adam Knights Avatar answered Oct 05 '22 14:10

Adam Knights