Kibana plugin controller inject error

(GuillaumeUnice) #1

Hello I try to make a hello world plugin inside kibana so I use the yeoman generator but there is the following error:
[ng:areq] Argument 'pluginTestHelloWorld' is not a function, got undefined

I show my index.js

import exampleRoute from './server/routes/example';

export default function (kibana) {
return new kibana.Plugin({
require: ['kibana', 'elasticsearch'],
uiExports: {
app: {
title: 'CloudUnit',
description: 'A CloudUnit plugin',
main: 'plugins/cloudunit_kibana/app',

    injectVars: function (server, options) {
      var config = server.config();
      return {
        kbnIndex: config.get('kibana.index'),
        esShardTimeout: config.get('elasticsearch.shardTimeout'),
        esApiVersion: config.get('elasticsearch.apiVersion')
  visTypes: [
config(Joi) {
  return Joi.object({
    enabled: Joi.boolean().default(true),
init(server, options) {
  // Add server routes and initalize the plugin here


And this is my app.js which contains my "pluginTestHelloWorld" controller

import moment from 'moment';
import chrome from 'ui/chrome';
import uiModules from 'ui/modules';
import uiRoutes from 'ui/routes';

import 'ui/autoload/styles';

//import './less/main.less';
import template from './templates/index.html';

.when('/', {
resolve: {
currentTime($http) {
return $http.get('../api/cloudunit_kibana/example').then(function (resp) {
controller: 'pluginTestHelloWorld'

.get('app/cloudunit_kibana', [])
.controller('pluginTestHelloWorld', function ($scope) {
$scope.title = 'Plugin Test';
$scope.description = 'An awesome Kibana plugin';

var currentTime = moment($route.current.locals.currentTime);
$scope.currentTime = currentTime.format('HH:mm:ss');
var unsubscribe = $interval(function () {
$scope.currentTime = currentTime.add(1, 'second').format('HH:mm:ss');
}, 1000);
$scope.$watch('$destroy', unsubscribe);

Do you know why the ng-controller syntaxe in template make this issue?

(Lukas Olson) #2

Are you specifying ng-controller="pluginTestHelloWorld" in the template in addition to specifying it in the definition of the route?

(GuillaumeUnice) #3

Yes of course this is the template:
<div class="container" ng-controller="pluginTestHelloWorld">


You've successfully created your first Kibana Plugin!

{{ title }}

{{ description }}

The current time is {{ currentTime }}

(Lukas Olson) #4

Could you try removing this line, as it's unnecessary if you're using ng-controller:

(GuillaumeUnice) #5

It's same problem I add this notation in order to bypass the problem but the is already the same issue :S

I don't understand because angular it's correctly instanciate but no possibility to declare a controller

You didn't have a git repo with a hello world plugin? because the generator yeoman doesn't operate correctly

Thanks for all

(Lukas Olson) #6

Can you share your package.json file contents? And what version of Kibana are you working with?

(GuillaumeUnice) #7

Yes of course,

I work with kibana 4.4, 4.6, 5.0 and master branch of kibana repository.

And this is my package.json:

"name": "cloudunit_kibana",
"version": "0.0.0",
"description": "An awesome Kibana plugin",
"main": "index.js",
"scripts": {
"lint": "eslint",
"start": "plugin-helpers start",
"test:server": "plugin-helpers test_server",
"test:browser": "plugin-helpers test_browser",
"build": "plugin-helpers build",
"postinstall": "plugin-helpers postinstall"
"devDependencies": {
"@elastic/eslint-config-kibana": "0.0.2",
"babel-eslint": "4.1.8",
"eslint": "1.10.3",
"eslint-plugin-mocha": "1.1.0",
"@elastic/plugin-helpers": "5.0.0-beta1",
"babel-runtime": "^5.0.0"
"dependencies": {
"@elastic/eslint-config-kibana": "0.0.2",
"@elastic/plugin-helpers": "5.0.0-beta1",
"babel": "5.8.23",
"babel-core": "5.8.23",
"babel-eslint": "4.1.8",
"babel-loader": "5.3.2",
"babel-runtime": "5.8.20",
"eslint": "1.10.3",
"eslint-plugin-mocha": "1.1.0",
"httpolyglot": "^0.1.1",
"moment": "^2.15.1",
"raw-loader": "^0.5.1",
"rjs-repack-loader": "^1.0.6"

(Lukas Olson) #8

Are you getting errors about versioning? The version in your package.json should match the version of Kibana you're targeting.

(system) #9