# Kibana plugin: embedded visualization error

**URL:** https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991
**Category:** Kibana
**Created:** [July 6, 2018, 11:08pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991 "2018-07-06T23:08:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![aapu](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aapu](https://discuss.elastic.co/u/aapu)
#### Post date: [July 6, 2018, 11:08pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/1 "2018-07-06T23:08:37Z")

</div>

Hello,

Based on Peter Pišljar's example ([https://www.elastic.co/blog/developing-new-kibana-visualizations](https://www.elastic.co/blog/developing-new-kibana-visualizations)), I'm trying to embed a visualization inside my kibana plugin.

My controller looks like this:

```
app.controller('TestVisApp', function ($scope, Private, serviceSettings) {
  const visContainer = $('.test-vis-app-visualize');
  getVisualizeLoader().then(loader => {
    loader.embedVisualizationWithId(visContainer, '68a473b0-8168-11e8-b601-d5f98337454c',
      {
        timeRange: {
          from: 'now-1y',
          to: 'now'
        }
      });
  });
});

```

Nevertheless, no matter which visualization id I try, I get the following error:

_Uncaught TypeError: Cannot read property 'from' of undefined ([https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903](https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903))_

_Error: Uncaught TypeError: Cannot read property 'from' of undefined ([https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903](https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903)) at window.onerror ([https://131.101.126.10:5601/zrq/bundles/commons.bundle.js?v=8467:36474:16](https://131.101.126.10:5601/zrq/bundles/commons.bundle.js?v=8467:36474:16))_

Here's the browser log:  
_:5601/zrq/bundles/commons.bundle.js?v=8467:734 Error: Uncaught TypeError: Cannot read property 'from' of undefined ([https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903](https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903))_  
\_ at window.onerror (:5601/zrq/bundles/commons.bundle.js?v=8467:36474)\_  
_Notifier.showFatal @ :5601/zrq/bundles/commons.bundle.js?v=8467:734  
 :5601/zrq/bundles/vendors.bundle.js?v=8467:1903 Uncaught TypeError: Cannot read property 'from' of undefined  
\_ at Timefilter.calculateBounds (:5601/zrq/bundles/commons.bundle.js?v=8467:33417)_  
\_ at Timefilter.getBounds (:5601/zrq/bundles/commons.bundle.js?v=8467:33412)\_  
\_ at getUpdateStatus (:5601/zrq/bundles/commons.bundle.js?v=8467:20052)\_  
\_ at Object._callee$ (:5601/zrq/bundles/commons.bundle.js?v=8467:40108)_  
\_ at tryCatch (:5601/zrq/bundles/vendors.bundle.js?v=8467:193098)\_  
\_ at Generator.invoke [as _invoke] (:5601/zrq/bundles/vendors.bundle.js?v=8467:193336)_  
\_ at Generator.prototype.(anonymous function) [as next] ([https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:193150:21](https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:193150:21))\_  
\_ at step (:5601/zrq/bundles/commons.bundle.js?v=8467:40003)\_  
\_ at :5601/zrq/bundles/commons.bundle.js?v=8467:40003\_  
_:5601/zrq/bundles/commons.bundle.js?v=8467:698 Uncaught Error: Uncaught TypeError: Cannot read property 'from' of undefined ([https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903](https://131.101.126.10:5601/zrq/bundles/vendors.bundle.js?v=8467:1903))_  
\_ at window.onerror (:5601/zrq/bundles/commons.bundle.js?v=8467:36474)\_  
_:5601/zrq/bundles/commons.bundle.js?v=8467:1010 tabify agg response_  
_:5601/zrq/bundles/commons.bundle.js?v=8467:1006 complete in 0.90ms_

Any ideas?  
I am using Kibana 6.2.1 and Elasticsearch 6.2.1.

Thanks in advance,  
Arturo.

---

<div class="post-metadata">

### Author: ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)
#### Post date: [July 9, 2018, 1:49pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/2 "2018-07-09T13:49:26Z")

</div>

Hm. It's hard to tell from that stacktrace. It looks like you're running your plugin in a production release of Kibana, which doesn't produce very easy stack traces for debugging purposes. I'd suggest pulling down Kibana's source code and running your plugin inside of that:

> **[elastic/kibana](https://github.com/elastic/kibana/tree/6.2)**
>
> kibana - :bar\_chart: Kibana analytics and search dashboard for Elasticsearch

That'll help you pinpoint the source of the error.

---

<div class="post-metadata">

### Author: ![aapu](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aapu](https://discuss.elastic.co/u/aapu)
#### Post date: [July 9, 2018, 4:42pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/3 "2018-07-09T16:42:29Z")

</div>

Chris,

thanks for your response.

I _am_ running in kibana's development code. Any other thing I can try?

This is how the fatal error is shown:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c04d4d083c4edee616b980799732d89d6f98cf6d.png)

Thanks.  
Arturo.

---

<div class="post-metadata">

### Author: ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)
#### Post date: [July 9, 2018, 6:12pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/4 "2018-07-09T18:12:47Z")

</div>

Ah. Wow, that's not a great stacktrace! Well, if you're running in dev-mode, you should have sourcemaps available if you pull up your browser's dev tools. Here's a link to how to pull those up for Chrome:

> **[Chrome DevTools  |  Tools for Web Developers
       |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/)**
>
> Get started with Google Chrome's built-in web developer tools.

If you open your dev tools, then refresh the page, you should see something in the console that pinpoints the source. I generally start poking around with breakpoints and console.logs until I track down the issue. I don't think there's a quick answer to your question. It'll require some digging in the dev tools to figure out where the problem lies.

---

<div class="post-metadata">

### Author: ![aapu](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aapu](https://discuss.elastic.co/u/aapu)
#### Post date: [July 9, 2018, 7:53pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/5 "2018-07-09T19:53:23Z")

</div>

Chris,

Sorry if I was not clear, by _browser log_ above I meant the logging in Chrome's DevTools.  
The first error occurs when the _loader.embedVisualizationWithId_ is called.

Any ideas?

---

<div class="post-metadata">

### Author: ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)
#### Post date: [August 6, 2018, 4:37pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/6 "2018-08-06T16:37:59Z")

</div>

Hi Arturo, sorry for the late response.

Did you ever solve this?

I don't have ideas other than to start putting debug console logs into your code to find out where it's going wrong. it sounds like it's trying to access a property "from" on an undefined time range, but it's not clear from the error whether that invalid access is happening in your visualization or in Kibana itself.

---

<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: [September 3, 2018, 4:38pm UTC](https://discuss.elastic.co/t/kibana-plugin-embedded-visualization-error/138991/7 "2018-09-03T16:38:05Z")

</div>

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