grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.02k stars 11.99k forks source link

TypeError: e is undefined #28120

Closed Berbe closed 3 years ago

Berbe commented 3 years ago

What happened: TypeError errors pop up in console, sometimes making a Dashboard crash.

No error spawned by the server run with a debug log level: definitely seems like a frontend error bug.

Error displayed when a Dashboard crashes ``` An unexpected error happened TypeError: e is undefined in t in P in div in t in t in t in t in t in f in t in div in t in div in t in div in t in div in t in x in div in o in DraggableCore in t in div in ReactGridLayout in Unknown in SizeMeReferenceWrapper in SizeMeRenderer(Component) in SizeMe(Component) in t in div in div in div in t in t in div in div in t in x in r in Unknown in t in Unknown in h in Unknown in Unknown in t in t in l ```
Examples of console error on Dashboard crash
Crash 1 ``` TypeError: e is undefined $r urlParser.ts:24 getValueForUrl urlParser.ts:8 getValueForUrl urlParser.ts:6 getValueForUrl adapter.ts:35 fillVariableValuesForUrl template_srv.ts:314 Lodash 2 ut ua fillVariableValuesForUrl template_srv.ts:304 getDataLinkUIModel link_srv.ts:324 getLinks linkSuppliers.ts:144 getLinks linkSuppliers.ts:143 getInfoContent PanelHeaderCorner.tsx:50 value Popover.tsx:82 render Popper.js:159 React 17 Xa Ya Su yc hc ic Xo unstable_runWithPriority Wo Xo Yo se Ar Tr kr unstable_runWithPriority _r react-dom.production.min.js:196:194 ```
Crash 2 ``` TypeError: e is undefined $r urlParser.ts:24 getValueForUrl urlParser.ts:8 getValueForUrl urlParser.ts:6 getValueForUrl adapter.ts:35 fillVariableValuesForUrl template_srv.ts:314 Lodash 2 ut ua fillVariableValuesForUrl template_srv.ts:304 getDataLinkUIModel link_srv.ts:324 getLinks linkSuppliers.ts:144 getLinks linkSuppliers.ts:143 getInfoContent PanelHeaderCorner.tsx:50 value Popover.tsx:82 render Popper.js:159 React 17 Xa Ya Su yc hc ic Xo unstable_runWithPriority Wo Xo Yo se Ar Tr kr unstable_runWithPriority _r react-dom.production.min.js:196:194 React 20 fu callback Oi mi mc unstable_runWithPriority Wo gc ic Xo unstable_runWithPriority Wo Xo Yo se Ar Tr kr unstable_runWithPriority _r ```
Example of console error while Dashboard did _not_ crash ``` Uncaught (in promise) TypeError: e is undefined $r urlParser.ts:24 getValueForUrl urlParser.ts:8 getValueForUrl urlParser.ts:6 getValueForUrl adapter.ts:35 Y actions.ts:540 X actions.ts:453 urlParser.ts:24:2 ne http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2 c http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2 ```

What you expected to happen: No error, no crash

How to reproduce it (as minimally and precisely as possible): Fiddling with template variables in order to make a Dashboard refresh, sometimes not doing anything other than hovering over Panels.

Anything else we need to know?: Other potentially related issues

v6.6.1 Error already encountered with v6.6.1

Console error v6.6.1 ``` TypeError: e is undefined escapeDelimiter plugin_page_ctrl.ts:23 getValueForUrl plugin_page_ctrl.ts:18 getValueForUrl plugin_page_ctrl.ts:18 getValueForUrl plugin_page_ctrl.ts:17 fillVariableValuesForUrl template_srv.ts:364 Lodash 2 Ye qa fillVariableValuesForUrl template_srv.ts:354 getDataLinkUIModel link_srv.ts:278 getLinks linkSuppliers.ts:149 getLinks linkSuppliers.ts:149 getInfoContent PanelHeaderCorner.tsx:52 render useLokiLabels.ts:31 render Popper.js:159 React 7 Za $a Tu Ts Os ms i unstable_runWithPriority scheduler.production.min.js:18 React 7 Gi $i Ki st Cn An Tn unstable_runWithPriority scheduler.production.min.js:18 r React react-dom.production.min.js:196:186 React 5 pu callback _o wo Ps unstable_runWithPriority scheduler.production.min.js:18 React 4 Gi Ps ms i unstable_runWithPriority scheduler.production.min.js:18 React 7 Gi $i Ki st Cn An Tn unstable_runWithPriority scheduler.production.min.js:18 r React ```

Environment:

mckn commented 3 years ago

@Berbe so the issues you have referenced is due to a different reason. I can see why you could think that they are related due to the error message but that is somewhat a standard error.

However the error you have posted has to do with the parsing of the URL. Could you share how the query string looks for your dashboard that crashes? That would help us resolve this.

Berbe commented 3 years ago

Thanks for this piece of information. Maybe could it be an idea to make those error messages more specific, if that is possible? It would help both reporters & solvers.


For all the following errors, the URL was http://127.0.0.1:3000/d/<dashboard UID>/<dashboard name>?orgId=1&refresh=1m

  1. Before crash
    Crash
Uncaught (in promise) TypeError: e is undefined
    $r urlParser.ts:24
    getValueForUrl urlParser.ts:8
    getValueForUrl urlParser.ts:6
    getValueForUrl adapter.ts:35
    Y actions.ts:540
    X actions.ts:453
urlParser.ts:24:2
    ne http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2
    c http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2

  1. After crash
    Crash 1
TypeError: e is undefined
    $r urlParser.ts:24
    getValueForUrl urlParser.ts:8
    getValueForUrl urlParser.ts:6
    getValueForUrl adapter.ts:35
    fillVariableValuesForUrl template_srv.ts:314
    Lodash 2
        ut
        ua
    fillVariableValuesForUrl template_srv.ts:304
    getDataLinkUIModel link_srv.ts:324
    getLinks linkSuppliers.ts:144
    getLinks linkSuppliers.ts:143
    getInfoContent PanelHeaderCorner.tsx:50
    value Popover.tsx:82
    render Popper.js:159
    React 17
        Xa
        Ya
        Su
        yc
        hc
        ic
        Xo
        unstable_runWithPriority
        Wo
        Xo
        Yo
        se
        Ar
        Tr
        kr
        unstable_runWithPriority
        _r
react-dom.production.min.js:196:194
    React 20
        fu
        callback
        Oi
        mi
        mc
        unstable_runWithPriority
        Wo
        gc
        ic
        Xo
        unstable_runWithPriority
        Wo
        Xo
        Yo
        se
        Ar
        Tr
        kr
        unstable_runWithPriority
        _r

Crash 2 ``` Error: Couldn't find variable with id:platform i selectors.ts:14 e actions.ts:482 c runtime.js:45 _invoke runtime.js:271 t runtime.js:97 z app.9f3acd666ba6dad3e060.js:2 i app.9f3acd666ba6dad3e060.js:2 actions.ts:494:12 ```
mckn commented 3 years ago

Thanks for this piece of information. Maybe could it be an idea to make those error messages more specific, if that is possible? It would help both reporters & solvers.

For all the following errors, the URL was http://127.0.0.1:3000/d/<dashboard UID>/<dashboard name>?orgId=1&refresh=1m

  1. Before crash

Crash

Uncaught (in promise) TypeError: e is undefined
    $r urlParser.ts:24
    getValueForUrl urlParser.ts:8
    getValueForUrl urlParser.ts:6
    getValueForUrl adapter.ts:35
    Y actions.ts:540
    X actions.ts:453
urlParser.ts:24:2
    ne http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2
    c http://127.0.0.1:3000/public/build/app.9f3acd666ba6dad3e060.js:2
  1. After crash

Crash 1

TypeError: e is undefined
    $r urlParser.ts:24
    getValueForUrl urlParser.ts:8
    getValueForUrl urlParser.ts:6
    getValueForUrl adapter.ts:35
    fillVariableValuesForUrl template_srv.ts:314
    Lodash 2
        ut
        ua
    fillVariableValuesForUrl template_srv.ts:304
    getDataLinkUIModel link_srv.ts:324
    getLinks linkSuppliers.ts:144
    getLinks linkSuppliers.ts:143
    getInfoContent PanelHeaderCorner.tsx:50
    value Popover.tsx:82
    render Popper.js:159
    React 17
        Xa
        Ya
        Su
        yc
        hc
        ic
        Xo
        unstable_runWithPriority
        Wo
        Xo
        Yo
        se
        Ar
        Tr
        kr
        unstable_runWithPriority
        _r
react-dom.production.min.js:196:194
    React 20
        fu
        callback
        Oi
        mi
        mc
        unstable_runWithPriority
        Wo
        gc
        ic
        Xo
        unstable_runWithPriority
        Wo
        Xo
        Yo
        se
        Ar
        Tr
        kr
        unstable_runWithPriority
        _r

Crash 2

Error: Couldn't find variable with id:platform
    i selectors.ts:14
    e actions.ts:482
    c runtime.js:45
    _invoke runtime.js:271
    t runtime.js:97
    z app.9f3acd666ba6dad3e060.js:2
    i app.9f3acd666ba6dad3e060.js:2
actions.ts:494:12

Could you share a copy of your dashboard json? Just so I can see what template variables you have setup?

Berbe commented 3 years ago

I am a bit unsettled about giving out potentially sensitive data. Hence, I anonymised the variables parts of the export JSON and will provide it to you through a share meant to expire within a day or so through a sharing mechanism available out there.

Here is that share (removed). Please be mindful about that piece of information, use it for the purposes of this issue only & swiftly discard it as soon as not required anymore.

torkelo commented 3 years ago

You seem to have a data link that is causing this, need the panel json for the panel in order to replicate this

Berbe commented 3 years ago

Share (removed) (1d expiration)

I noticed some errors happened when I tried to update the template variables. In particular, I noticed requests to http://127.0.0.1:3000/api/datasources/proxy/1/api/v1/metadata ending up with HTTP 404. Is that expected?

mckn commented 3 years ago

@Berbe thanks for reporting this! I have opened a fix for this.

Berbe commented 3 years ago

Thanks a lot @torkelo, @mckn!