marcusolsson / grafana-gantt-panel

A panel plugin for Grafana to visualize Gantt charts.
Apache License 2.0
26 stars 12 forks source link

DetailsTypeError: Cannot read properties of undefined (reading 'enabled') #70

Closed burhus closed 2 years ago

burhus commented 2 years ago

Heya!

I have two environments running this awesome plugin, in the first environment the plugin works like a charm but on the second environment I keep getting an error. Both environments are running the same version of Grafana (Grafana v8.3.3 (30bb7a93ca)) and settings wise they are the same other than the environment that the plugin is not working on has OAuth2 login enabled whereas the other "labb" environment uses basic authentication.

Any idea what might be the cause?

An unexpected error happened
DetailsTypeError: Cannot read properties of undefined (reading 'enabled')

    at zn (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:275:590)
    at div
    at div
    at tr (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:393:501)
    at div
    at t (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:426:3233)
    at div
    at t (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:426:5184)
    at _r (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:426:10798)
    at div
    at div
    at ia (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:486:6049)
    at v (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:971570)
    at div
    at Mi (https://super-secret-url.com/public/build/DashboardPage.6839ffb2aed352838f3a.js:574:3581)
    at DashboardPage
    at v (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:971570)
    at n (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:942012)
    at zi (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:6393:193)
    at t (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:989568)
    at t (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:991589)
    at main
    at t (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:986186)
    at div
    at Ws (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:2156:1022)
    at d (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:4480:26210)
    at Sl (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:2868:458)
    at Tl (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:2868:1006)
    at l (https://super-secret-url.com/public/build/633.6839ffb2aed352838f3a.js:2:969088)
    at Oo (https://super-secret-url.com/public/build/7095.6839ffb2aed352838f3a.js:6473:384)
StefanAlexandruBogdan commented 2 years ago

I am reproducing the same issue with Grafana 8.3.3 (30bb7a93ca)

stllok commented 2 years ago

Reproducing the issue with Grafana v8.3.2 (afb9e8e5f)

marcusolsson commented 2 years ago

Thanks for reporting this! I'll be able to look into this during next week. In the meantime, if there's any steps I need to take to reproduce this, let me know!

StefanAlexandruBogdan commented 2 years ago

Adding some info in case it helps:

For me is always reproducing on 8.3.3. I was able to work around it by downgrading it to 7.3.0. As a step to reproduce just try to add a new dashboard, new panel, and select GANTT visualization. That's it. The data source does not seem to make a difference. Also, one interesting data point is that the already created dashboards in (7.3.0) continue to work after the upgrade. I reproduced this issue on both a newly installed Grafana 8.3.3 and also on a setup where I upgraded from 7.3.0. In both cases downgrading to 7.3.0 fixed the issue.

Looking at the stack trace, the exception happens in getPanelPluginOrFallback when trying to evaluate options.experiments object in a showif method: .addBooleanSwitch({ path: 'experiments.lockToExtents', name: 'Lock to extents', description: 'Locks the view to the oldest start time and the most recent end time. This disables zooming.', category: ['Experiments'], showIf: (options) => options.experiments.enabled, }) In my case options object was: {showYAxis: true, sortBy: 'startTime', sortOrder: 'asc'}

Strack trace: TypeError: Cannot read properties of undefined (reading 'enabled') at Object.showIf (http://xxx.xxx.xxx.xxx/grafana/public/plugins/marcusolsson-gantt-panel/module.js:1:106796) at rn (http://xxx.xxx.xxx.xxx/grafana/public/build/DashboardPage.6839ffb2aed352838f3a.js:242:4766) at nn (http://xxx.xxx.xxx.xxx/grafana/public/build/DashboardPage.6839ffb2aed352838f3a.js:242:4036) at http://xxx.xxx.xxx.xxx/grafana/public/build/DashboardPage.6839ffb2aed352838f3a.js:275:726 at Object.Ei [as useMemo] (http://xxx.xxx.xxx.xxx/grafana/public/build/633.6839ffb2aed352838f3a.js:2:769850) at t.useMemo (http://xxx.xxx.xxx.xxx/grafana/public/build/633.6839ffb2aed352838f3a.js:2:2818449) at zn (http://xxx.xxx.xxx.xxx/grafana/public/build/DashboardPage.6839ffb2aed352838f3a.js:275:713) at ri (http://xxx.xxx.xxx.xxx/grafana/public/build/633.6839ffb2aed352838f3a.js:2:765146) at Bi (http://xxx.xxx.xxx.xxx/grafana/public/build/633.6839ffb2aed352838f3a.js:2:774664) at Zs (http://xxx.xxx.xxx.xxx/grafana/public/build/633.6839ffb2aed352838f3a.js:2:818201)

marcusolsson commented 2 years ago

I've released a fix for https://github.com/marcusolsson/grafana-gantt-panel/issues/64, which looks related to this one. Could someone check and see if this issue remains in 0.7.5?