Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation Warning: Using the injected container is deprecated. #396

Closed
duro opened this issue Jun 18, 2016 · 6 comments
Closed

Deprecation Warning: Using the injected container is deprecated. #396

duro opened this issue Jun 18, 2016 · 6 comments

Comments

@duro
Copy link

duro commented Jun 18, 2016

Version info

e.g.
DEBUG: -------------------------------
DEBUG: Ember      : 2.5.1
DEBUG: Ember Data : 2.6.1
DEBUG: Firebase   : 3.0.5
DEBUG: EmberFire  : 2.0.0
DEBUG: jQuery     : 2.2.4
DEBUG: -------------------------------

Steps to reproduce

Use this.get('session').fetch() in a beforeModel route hook.

// /app/routes/application.js
export default Ember.Route.extend({
  beforeModel() {
    return this.get('session').fetch().catch(function(){});
  }
});

Expected behavior

Should not throw a deprecation warning

Actual behavior

Throws the following warning:

Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `_lookupFactory` instead. [deprecation id: ember-application.injected-container] See http://emberjs.com/deprecations/v2.x#toc_injected-container-access for more details.
        at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:16472:7)
        at raiseOnDeprecation (http://localhost:4200/assets/vendor.js:16380:12)
        at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:16472:7)
        at invoke (http://localhost:4200/assets/vendor.js:16488:7)
        at deprecate (http://localhost:4200/assets/vendor.js:16441:32)
        at Object.deprecate (http://localhost:4200/assets/vendor.js:26480:37)
        at Object.lookupFactory (http://localhost:4200/assets/vendor.js:43550:24)
        at Object.create (http://localhost:4200/assets/vendor.js:95008:42)
        at instantiate (http://localhost:4200/assets/vendor.js:11633:23)

I have traced this down to line 38 in the addon/torii-providers/firebase.js file:

      default:
        const ProviderClass = this.container.lookupFactory(`firebase-auth-provider:${providerId}`);
        if (!ProviderClass) {
          return this.waitFor_(reject(new Error('Unknown provider')));
        }

This needs to be changed over to use the getOwner method of looking things up.

See: http://emberjs.com/deprecations/v2.x/#toc_injected-container-access

@mohitsud
Copy link

mohitsud commented Jul 2, 2016

Bump!
It would be great if this change could be made.

dunnkers added a commit to dunnkers/emberfire that referenced this issue Jul 4, 2016
Updated deprecated `container.lookup` calls to make use of the favoured
`getOwner()` function. Users of Ember 2.3 and above will no longer see
deprecation warnings about this.
@roscorcoran
Copy link

Agreed would also like to see this fixed

@brendanoh
Copy link

This seems like it will be ok until Ember 3.0 and a PR with fix was merged into Master on July 7th.

So I think if you point to master it will go away until they cut another release.

@mminkoff
Copy link

As elsewhere, ember-cli-deprecation-workflow is your friend here.

@deckyfx
Copy link

deckyfx commented Sep 28, 2016

+1 for this,

Still no workaround?

@jamesdaniels
Copy link
Contributor

We're cutting 2.0.2 today, this includes the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants