Francois
Francois

Reputation: 683

finding source of deprecation errors

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.

Upvotes: 9

Views: 1439

Answers (3)

Adam Knights
Adam Knights

Reputation: 2151

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.

Upvotes: 4

Christian Fazzini
Christian Fazzini

Reputation: 19723

Its difficult at this time to go through the trace route to determine where the deprecation warning is coming from. However, what I did was the following:

cd project_directory
ack Ember.keys > output

Which will output the results onto a file called output. Open it and you will notice which files are still using the old syntax. For example, in my case:

node_modules/ember-disable-proxy-controllers/dist/assets/vendor.js` 

Line 60458. At this point, you can contact the author to suggest a fix. I believe the solution would be to replace all instances of Ember.keys with something more sensible like (Object.keys || Ember.keys).

But do keep in mind, that this is a deprecation warning (which should be addressed in the future, ideally), and it shouldn't affect code.

Upvotes: 2

Kingpin2k
Kingpin2k

Reputation: 47367

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.

Upvotes: 7

Related Questions