# Debugging Kibana plugin server-side

**URL:** <https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895>\
**Category:** Kibana\
**Created:** [September 18, 2017, 3:32pm UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895 "2017-09-18T15:32:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivasamyk](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@sivasamyk](https://discuss.elastic.co/u/sivasamyk)\
**Post date:** [September 18, 2017, 3:32pm UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895/1 "2017-09-18T15:32:57Z")

</div>

Added _NODE\_OPTIONS="--debug-brk --inspect'_ and started kibana using _npm start_ from my plugin source dir. After launching _chrome://inspect_, I can see Kibana server code listed in sources but not my plugin source code. How can I attach my plugin source to debugger?

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [September 20, 2017, 5:13pm UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895/2 "2017-09-20T17:13:15Z")

</div>

Are you seeing in the Kibana console that optimization completed? Does the list of plugins that were optimized include your plugin?

I've previously attempted to do what you're trying, but I have always given up because the optimization process takes too long to be able to work this way. I usually just use `console.log` to debug my plugin in server-side code.

---

<div class="post-metadata">

**Author:** ![sivasamyk](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@sivasamyk](https://discuss.elastic.co/u/sivasamyk)\
**Post date:** [September 21, 2017, 1:31am UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895/3 "2017-09-21T01:31:18Z")

</div>

It worked for me with `NODE_OPTIONS='--inspect --debug'`. Following is the ouput when I run `npm start`. Lazy Optimization completed and my plugin code got listed in chrome://inspect and I was able to add break points to my plugin source. The last chrome-devtools url on port 5860 worked for me. I using Kibana 5.6.1.

```
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
    chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/afab0912-855c-402d-9799-f025b1add093
 watching for changes (421 files)
  log [01:22:43.616] [info][listening] basePath Proxy running at https://0.0.0.0:5601/abx
Debugger listening on port 5859.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
    chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5859/2120ca31-11b0-4143-89d2-acd909084a83
Debugger listening on port 5860.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
    chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5860/c30dbdb4-aa1d-4067-af56-d95c6ec70fdc
optmzr log [01:22:49.011] [info][status][ui settings] Status changed from uninitialized to disabled - uiSettings.enabled config is set to `false`
server log [01:22:50.788] [info][optimize] Waiting for optimizer completion
optmzr log [01:22:50.895] [info][optimize] Lazy optimization of bundles for logtrail, kibana, stateSessionStorageRedirect, timelion, sense-tests and status_page ready
optmzr log [01:22:50.914] [info] Plugin initialization disabled.
server log [01:22:50.986] [info][status][plugin:kibana@5.6.1] Status changed from uninitialized to green - Ready
server log [01:22:51.155] [info][status][plugin:elasticsearch@5.6.1] Status changed from uninitialized to yellow - Waiting for Elasticsearch
server log [01:22:51.222] [info][status][plugin:logtrail@0.1.21] Status changed from uninitialized to green - Ready
server log [01:22:51.257] [info][status][plugin:console@5.6.1] Status changed from uninitialized to green - Ready
server log [01:22:51.313] [info][status][plugin:metrics@5.6.1] Status changed from uninitialized to green - Ready
optmzr log [01:22:52.868] [info][optimize] Lazy optimization started
server log [01:22:55.231] [info][status] Loaded 773 source patterns from ES ...
server log [01:22:55.238] [error][status][plugin:elasticsearch@5.6.1] Status changed from yellow to red - Request Timeout after 3000ms
server log [01:22:55.240] [info][status][plugin:timelion@5.6.1] Status changed from uninitialized to green - Ready
server log [01:22:55.246] [info][listening] Server running at https://0.0.0.0:5603
server log [01:22:55.249] [error][status][ui settings] Status changed from uninitialized to red - Elasticsearch plugin is red
server log [01:22:57.783] [warning] You're running Kibana 5.6.1 with some different versions of Elasticsearch. Update Kibana or Elasticsearch to the same version to prevent compatibility issues: v5.6.0 @ 127.0.0.1:9200 (127.0.0.1)
server log [01:22:58.138] [info][status][plugin:elasticsearch@5.6.1] Status changed from red to green - Kibana index ready
server log [01:22:58.140] [info][status][ui settings] Status changed from red to green - Ready
Debugger attached.
optmzr log [01:24:00.354] [info][optimize] Lazy optimization success in 67.38 seconds
optmzr log [01:24:04.437] [info][optimize] Lazy optimization started
optmzr log [01:24:06.481] [info][optimize] Lazy optimization success in 2.04 seconds
```

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [September 21, 2017, 4:01pm UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895/4 "2017-09-21T16:01:48Z")

</div>

Good to know! So maybe using `--debug-brk` does something that makes it not work as well compared to `--debug`

---

<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:** [October 19, 2017, 4:01pm UTC](https://discuss.elastic.co/t/debugging-kibana-plugin-server-side/100895/5 "2017-10-19T16:01:51Z")

</div>

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