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

Metrics adapters no longer inject services. #541

Open
veelci opened this issue Feb 16, 2023 · 0 comments
Open

Metrics adapters no longer inject services. #541

veelci opened this issue Feb 16, 2023 · 0 comments

Comments

@veelci
Copy link

veelci commented Feb 16, 2023

I have a few custom adapters in my application that depend on injected services.

I've updated my app to use ember-metrics 2.0.0-beta.2 and am now seeing this error in the console when running the app:

Uncaught (in promise) Error: Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.

Proposing this change to the metrics service to fix this:

  /**
   * Instantiates an adapter.
   *
   * @method _activateAdapter
   * @param {Object}
   * @private
   * @return {Adapter}
   */
  _activateAdapter({ adapterClass, config }) {
    const adapter = new adapterClass(config);
    setOwner(adapter, getOwner(this));
    adapter.install();
    return adapter;
  }
veelci added a commit to aboveproperty/ember-metrics that referenced this issue Feb 16, 2023
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

1 participant