Skip to content

Problem when autoloading styles in Kibana plugin #5349

@kimjoar

Description

@kimjoar

I get this error when only autoloading styles:

angular.js:12477 Error: [$injector:unpr] Unknown provider: NotifierProvider <- Notifier <- globalState <- timefilter
http://errors.angularjs.org/1.4.7/$injector/unpr?p0=NotifierProvider%20%3C-%20Notifier%20%3C-%20globalState%20%3C-%20timefilter
    at angular.js:68
    at angular.js:4289
    at Object.getService [as get] (angular.js:4437)
    at angular.js:4294
    at getService (angular.js:4437)
    at Object.invoke (angular.js:4469)
    at instantiate (private.js:144)
    at get (private.js:162)
    at Private (private.js:182)
    at new <anonymous> (global_state.js:10)

This only happens if I set up the router.

I've got a minimal example running with this error. Here is the main file, index.js:

module.exports = (kibana) => new kibana.Plugin({
  id: 'my-app',

  uiExports: {
    app: {
      title: 'My app',
      main: 'plugins/my-app',
      autoload: kibana.autoload.styles
    }
  }
});

and in public/index.js:

import chrome from 'ui/chrome';
import routes from 'ui/routes';

chrome
  .setRootController(() => {
    console.log('app is running');
  });

routes
  .when('/', {
      template: '<div></div>',
      controller: () => {
        console.log('root')
      }
  })
  .otherwise({ redirectTo: '/' });

Whenever I refresh this app I get the error. If I add more routes and add urls to jump between them, I get this error:

angular.js:12477 Error: Circular refrence to "StateProvider" found while resolving private deps: StateProvider
    at instantiate (private.js:135)
    at get (private.js:162)
    at Private (private.js:182)
    at new <anonymous> (global_state.js:10)
    at invoke (angular.js:4478)
    at Object.instantiate (angular.js:4486)
    at Object.<anonymous> (angular.js:4346)
    at Object.invoke (angular.js:4478)
    at Object.enforcedReturnValue [as $get] (angular.js:4330)
    at Object.invoke (angular.js:4478)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:PluginsbugFixes for quality problems that affect the customer experience

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions