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

[6.4.0] $rootScope.$listen is not a function error while trying to get VisTypes list #23278

Closed
gmatheus opened this issue Sep 18, 2018 · 6 comments
Labels
Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@gmatheus
Copy link

Hi!

Some months ago, I developed a Kibana plugin targeting 6.1.1 version. Now I'm trying to update the plugin files in order to make it work on Kibana 6.4.0.

There's this part of code where I need to get the VisTypes list:

import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

export function decorateVis(Private) {
  const VisTypes = Private(VisTypesRegistryProvider);
  
  // ...

I get this error trying to run it in Kibana 6.4.0:

Uncaught TypeError: $rootScope.$listen is not a function
    at new Courier (courier.js:59)
    at new <anonymous> (courier.js:108)
    at Object.instantiate (angular.js:5121)
    at Object.<anonymous> (angular.js:4955)
    at Object.invoke (angular.js:5106)
    at Object.enforcedReturnValue [as $get] (angular.js:4939)
    at Object.invoke (angular.js:5106)
    at angular.js:4893
    at getService (angular.js:5047)
    at injectionArgs (angular.js:5072)
    at Object.invoke (angular.js:5098)
    at instantiate (private.js:161)
    at get (private.js:179)
    at Private (private.js:199)
    at Array.map (<anonymous>)
    at Object.registry (_registry.js:104)

The Private injector comes from this file.

Can someone help me with this? I know there was a removal of services in the last version of Kibana, but it seems that it's not the case (VisTypesRegistryProvider still needs Private injector).

@stacey-gammon stacey-gammon added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 19, 2018
@gmatheus
Copy link
Author

This is also happening with VisProvider:

import { VisProvider } from 'ui/vis/vis';

export function decorateVis(Private) {
  const Vis = Private(VisProvider);

  // ...

@gmatheus
Copy link
Author

Guys, it seems that this behavior is related to ui/modules:

In this file (my plugin module definition), if I change the uiModules.get('comparable_time_range', ['kibana']) for uiModules.get('kibana'), it works as expected.

I'm changing the code for the second option for now, but shouldn't the custom module definition work as well (since I define kibana module in requires list)?

@timroes
Copy link
Contributor

timroes commented Nov 14, 2018

cc @spalger is that some side effect we are aware of something that could break that? I would also consider, that uiModules.get('comparable_time_range', ['kibana']) should also work for that case.

@timroes
Copy link
Contributor

timroes commented Nov 14, 2018

Looking again, since you decorate some services that are inside the kibana module you might need to be inside the run method of that same module.

Also some heads up: You are very deeply integrating into a lot of internal Kibana services.. especially a lot that we are currently refactoring. I think every other minor release in 6.x might still cause you a lot of refactoring in your plugin unfortunately.

Some PRs that might be relevant:

@gmatheus
Copy link
Author

Hey @timroes, thanks for your reply! I'll use the uiModules.get('kibana') option then.

Also thanks for your advices on Kibana releases. In fact, I refactored a lot of things for 6.4.x versions in this PR, and I think it's ready to be merged. I'll take a look in the 6.5 API Changes once my team decides to upgrade the ELK stack!

@timroes
Copy link
Contributor

timroes commented Dec 11, 2018

I'll close this, since it seems we found a solution for that. Please feel free to leave a comment if it needs to be reopened.

@timroes timroes closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants