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

Uncaught Error: [$injector:unpr] Unknown provider: kbnIndexProvider <- kbnIndex <- config #6445

Closed
salyh opened this issue Mar 7, 2016 · 4 comments

Comments

@salyh
Copy link

salyh commented Mar 7, 2016

I try to write a Kibana app and its working well with the current master version of Kibana (Version 5).
But the plugin is not running within Kibana 4.4 (and also not in 4.2/4.3, 4.5 snapshot is also failing). The issue i'am facing is this one:

Uncaught Error: [$injector:unpr] Unknown provider: kbnIndexProvider <- kbnIndex <- config
http://errors.angularjs.org/1.4.7/$injector/unpr?p0=kbnIndexProvider%20%3C-%20kbnIndex%20%3C-%20config (http://localhost:5601/bundles/commons.bundle.js?v=9863:31533)

Version: 4.5.0-snapshot
Build: 9863

Error: Uncaught Error: [$injector:unpr] Unknown provider: kbnIndexProvider <- kbnIndex <- config
http://errors.angularjs.org/1.4.7/$injector/unpr?p0=kbnIndexProvider%20%3C-%20kbnIndex%20%3C-%20config (http://localhost:5601/bundles/commons.bundle.js?v=9863:31533)
    at window.onerror (http://localhost:5601/bundles/commons.bundle.js?v=9863:65461:25)

There is already a closed issue (#5349) addressing this but for me this is not solved yet.

See also https://discuss.elastic.co/t/unknown-provider-error-in-kibana/43496

@spalger
Copy link
Contributor

spalger commented Mar 7, 2016

@salyh the same solution from #5349 would have to be applied to your app, and it will look a lot like #6173.

Basically, there are kibana modules that don't properly map out their dependencies and when requiring things from ui/* modules don't always get their dependencies loaded properly. This isn't something we plan to fix in older versions of Kibana, and something we plan to fix as we come across it in newer versions.

For now, the easiest solution for you would be to autoload everything as part of your application, but this will add significant weight to your application.

The more complex solution is to map the dependencies that aren't properly mapped (like I did in #6173). If you are interested in this approach let me know and I can go into more detail about how that works.

@spalger
Copy link
Contributor

spalger commented Mar 7, 2016

Closing, since there aren't action items here, but feel free to respond.

@spalger spalger closed this as completed Mar 7, 2016
@psurya
Copy link

psurya commented Mar 16, 2016

add this in your index.js. it should work fine. Did for me.

       injectVars: function (server, options) {
         var config = server.config();
         return {
             kbnIndex: config.get('kibana.index'),
             esShardTimeout: config.get('elasticsearch.shardTimeout'),
             esApiVersion: config.get('elasticsearch.apiVersion')
         };
       }

@tuxtitlan
Copy link

@spalger would you mind to elaborate on the approach you used on #6173?

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

4 participants