# The following is the code for creating a user dictionary Kibana plugin. However, when executed, it cannot reference the module named 'files:Filesetup', resulting in an error with 'undefined'. Is there anything I might be missing in my plugin development?

**URL:** https://discuss.elastic.co/t/the-following-is-the-code-for-creating-a-user-dictionary-kibana-plugin-however-when-executed-it-cannot-reference-the-module-named-files-filesetup-resulting-in-an-error-with-undefined-is-there-anything-i-might-be-missing-in-my-plugin-development/348845
**Category:** Kibana
**Tags:** kibana-plugin-development
**Created:** [December 8, 2023, 1:34am UTC](https://discuss.elastic.co/t/the-following-is-the-code-for-creating-a-user-dictionary-kibana-plugin-however-when-executed-it-cannot-reference-the-module-named-files-filesetup-resulting-in-an-error-with-undefined-is-there-anything-i-might-be-missing-in-my-plugin-development/348845 "2023-12-08T01:34:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![choije](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/choije/32/128968_2.png) [@choije](https://discuss.elastic.co/u/choije)
#### Post date: [December 8, 2023, 1:34am UTC](https://discuss.elastic.co/t/the-following-is-the-code-for-creating-a-user-dictionary-kibana-plugin-however-when-executed-it-cannot-reference-the-module-named-files-filesetup-resulting-in-an-error-with-undefined-is-there-anything-i-might-be-missing-in-my-plugin-development/348845/1 "2023-12-08T01:34:31Z")

</div>

The following is the code for creating a user dictionary Kibana plugin. However, when executed, it cannot reference the module named 'files:Filesetup', resulting in an error with 'undefined'. Is there anything I might be missing in my plugin development?

```auto
import { PLUGIN_ID, PLUGIN_NAME, dictionaryFileKind, DicImageMetadata } from '../common';
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '../../../src/core/public';
import { UserDictionaryPluginSetup, UserDictionaryPluginStart } from './types';

export class UserDictionaryPlugin
  implements Plugin<unknown, unknown, UserDictionaryPluginSetup, UserDictionaryPluginStart>
{
  public setup(
    core: CoreSetup<UserDictionaryPluginStart>,
    { files }: UserDictionaryPluginSetup
  ) {
    console.log('UserDictionaryPluginSetup:', { files })
    if (!files) {
      console.error('Error: files is undefined.');
      // 적절한 디폴트 값을 반환하거나, 에러 처리를 추가하세요.
      return {};
    }
    files.registerFileKind({
      id: dictionaryFileKind.id,
      allowedMimeTypes: dictionaryFileKind.allowedMimeTypes,
    });
    // Register an application into the side navigation menu
    core.application.register({
      id: PLUGIN_ID,
      title: PLUGIN_NAME,
      async mount(params: AppMountParameters) {
        // Load application bundle
        const { renderApp } = await import('./application');
        // Get start services as specified in kibana.json
        const [coreStart, depsStart] = await core.getStartServices();
        // Render the application
        return renderApp(coreStart,
          {
            files: {
              unscoped: depsStart.files.filesClientFactory.asUnscoped<DicImageMetadata>(),
              example: depsStart.files.filesClientFactory.asScoped<DicImageMetadata>(dictionaryFileKind.id),
            },
          },
          params);
      },
    });

    // Return methods that should be available to other plugins
    return {};
  }

  public start(core: CoreStart) {
    return {};
  }

  public stop() { }
}

```

The following is the error message:  
UserDictionaryPluginSetup:

1. {files: undefined}

2. files: undefined

3. [[Prototype]]: Object

```
1. constructor: ƒ Object()
2. hasOwnProperty: ƒ hasOwnProperty()
3. isPrototypeOf: ƒ isPrototypeOf()
4. propertyIsEnumerable: ƒ propertyIsEnumerable()
5. toLocaleString: ƒ toLocaleString()
6. toString: ƒ toString()
7. valueOf: ƒ valueOf()
8. __defineGetter__ : ƒ __defineGetter__ ()
9. __defineSetter__ : ƒ __defineSetter__ ()
10. __lookupGetter__ : ƒ __lookupGetter__ ()
11. __lookupSetter__ : ƒ __lookupSetter__ ()
12. __proto__ : (...)
13. get __proto__ : ƒ __proto__ ()
14. set __proto__ : ƒ __proto__ ()

```

---

<div class="post-metadata">

### Author: ![choije](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/choije/32/128968_2.png) [@choije](https://discuss.elastic.co/u/choije)
#### Post date: [December 9, 2023, 2:23am UTC](https://discuss.elastic.co/t/the-following-is-the-code-for-creating-a-user-dictionary-kibana-plugin-however-when-executed-it-cannot-reference-the-module-named-files-filesetup-resulting-in-an-error-with-undefined-is-there-anything-i-might-be-missing-in-my-plugin-development/348845/2 "2023-12-09T02:23:45Z")

</div>

Resolved. Thank you.

---

<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: [January 6, 2024, 2:24am UTC](https://discuss.elastic.co/t/the-following-is-the-code-for-creating-a-user-dictionary-kibana-plugin-however-when-executed-it-cannot-reference-the-module-named-files-filesetup-resulting-in-an-error-with-undefined-is-there-anything-i-might-be-missing-in-my-plugin-development/348845/3 "2024-01-06T02:24:00Z")

</div>

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