Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana variable loading issue: "Templating [VARIABLE_NAME] Error updating options: Cannot read properties of undefined (reading 'split')" #1061

Open
Man1103 opened this issue Nov 22, 2024 · 1 comment
Labels
datasource/ClickHouse type/bug Something isn't working

Comments

@Man1103
Copy link

Man1103 commented Nov 22, 2024

What happened:
After setting up Grafana dashboard, having issue during dashboard loading where it is unable to load variables into filters.
The error thrown is - "Templating [VARIABLE_NAME] Error updating options: Cannot read properties of undefined (reading 'split').
It does work after reloading Grafana multiple times. This is frustrating to do all the times.

What you expected to happen:
Expected dashboard to successfully load the variables in filters as the query is correct and tested before saving the dashboard.

How to reproduce it (as minimally and precisely as possible):
Take any Clickhouse SQL query where you can fetch distinct values of column from any table. This is the same as we are facing.

  1. Go to Dashboard -> Variables
  2. Click on Any variable that you have created using Clickhouse query
  3. Scroll down to bottom and check if query output is rendered and save the variable as well as dashboard
  4. Load the Grafana in browser and see the error

Screenshots
1).

Image
2).

Image

**Anything else we need to know? **:
As we checked the console errors in browser, we found following info:

styles.ts:5 Unable to parse ClickHouse version: TypeError: Cannot read properties of undefined (reading 'split')

eval @ styles.ts:5Understand this errorAI

actions.ts:1028 TypeError: Cannot read properties of undefined (reading 'split')
at eval (styles.ts:5:15)
at Generator.next ()
at Re (styles.ts:5:15)
at o (styles.ts:5:15)
at s.invoke (module.ts:31:16)
at c.run (module.ts:31:16)
at eval (module.ts:31:16)
at s.invokeTask (module.ts:31:16)
at c.runTask (module.ts:31:16)
at m (module.ts:31:16)
(anonymous) @ actions.ts:1028Understand this errorAI

module.ts:31 Uncaught TypeError: Cannot read properties of undefined (reading 'split')
at eval (styles.ts:5:15)
at Generator.next ()
at Re (styles.ts:5:15)
at o (styles.ts:5:15)
at s.invoke (module.ts:31:16)
at c.run (module.ts:31:16)
at eval (module.ts:31:16)
at s.invokeTask (module.ts:31:16)
at c.runTask (module.ts:31:16)
at m (module.ts:31:16)Understand this errorAI

deprecationWarning.ts:14 [Deprecation warning] DataSource grafana-clickhouse-datasource: templateSrv.getAdhocFilters is deprecated. Use filters property on the request (DataQueryRequest). Or if this is called from interpolateVariablesInQueries or applyTemplateVariables it is passed as a new argument instead

This last one is important as it is throwing deprecationWarning.

Environment:

  • Grafana version: Grafana v10.4.8
  • Plugin version: Latest
  • OS Grafana is installed on: Linux
  • User OS & Browser: MacOS
  • Others: Google Chrome browser
@Man1103 Man1103 added datasource/ClickHouse type/bug Something isn't working labels Nov 22, 2024
@SpencerTorres
Copy link
Collaborator

Thanks for this issue, this part seems to stand out to me the most:

As we checked the console errors in browser, we found following info:
styles.ts:5 Unable to parse ClickHouse version: TypeError: Cannot read properties of undefined (reading 'split')

Sounds like something isn't loading in time, or is returning the wrong data? Seems like this could be fixed with a null check somewhere.

Just in case the problem is more complex than that, can you provide some more info/screenshots about your variable and which query you're using for it? I would also check to see if there's somehow a permission issue with running queries to check the ClickHouse version.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource/ClickHouse type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants