# uiCapabilities is undefined

**URL:** https://discuss.elastic.co/t/uicapabilities-is-undefined/241728
**Category:** Kibana
**Created:** [July 17, 2020, 10:03pm UTC](https://discuss.elastic.co/t/uicapabilities-is-undefined/241728 "2020-07-17T22:03:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![npm\_install](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@npm\_install](https://discuss.elastic.co/u/npm_install)
#### Post date: [July 17, 2020, 10:03pm UTC](https://discuss.elastic.co/t/uicapabilities-is-undefined/241728/1 "2020-07-17T22:03:31Z")

</div>

Hi,

I am creating a custom plugin for Kibana, and I am running into an issue with the plugin registration feature in this documentation: [https://www.elastic.co/guide/en/kibana/current/development-plugin-feature-registration.html](https://www.elastic.co/guide/en/kibana/current/development-plugin-feature-registration.html)

When I try to look at the plugin after I installed I get the error:  
`TypeError: Cannot read property 'myPlugin' of undefined`

I have added to my code the registration code:

```auto
    init(server) {
      const xpackMainPlugin = server.plugins.xpack_main;
      xpackMainPlugin.registerFeature({
        id: 'myPlugin',
        name: 'My Plugin',
        icon: 'merge',
        navLinkId: 'myPlugin',
        app: ['myPlugin', 'kibana'],
        catalogue: ['myPlugin'],
        privileges: {
          all: {
            savedObject: {
              all: [],
              read: [],
            },
            ui: ['show'],
          },
          read: {
            savedObject: {
              all: [],
              read: [],
            },
            ui: ['show'],
          },
        },
      });
    }

```

and the code to utilize the boolean to show a feature or not:

```auto
    import { uiCapabilities } from 'ui/capabilities';

    const show = uiCapabilities.myPlugin.show;
    if (show) {
      // show feature
    }

```

Is there some setup or configuration that I am missing in order to use uiCapabilities and have it defined?

---

<div class="post-metadata">

### Author: ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)
#### Post date: [July 17, 2020, 10:26pm UTC](https://discuss.elastic.co/t/uicapabilities-is-undefined/241728/2 "2020-07-17T22:26:50Z")

</div>

@npm_install Welcome to the forum!  
We've been migrating the entire codebase and API's have changed. If you've created your plugin using the [plugin generator](https://www.elastic.co/guide/en/kibana/current/development-plugin-resources.html#_plugin_generator), then following the guide given in the docs should get you to a basic plugin that you can further develop on. If you haven't, try that, it should work.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 14, 2020, 10:27pm UTC](https://discuss.elastic.co/t/uicapabilities-is-undefined/241728/3 "2020-08-14T22:27:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
