Error loading panel plugin

I have a panel that worked for Grafana 6.5 and no more for 6.6 and 6.7.

My failure in the console is:

SyntaxError: Unexpected token '<'

I didn’t find the problem of my panel. Can anyone help me?

The whole error is probably visible in the Chrome Dev Console. It usually means that the JavaScript for the plugin is invalid or couldn’t be found and therefore couldn’t be loaded.

The real error is probably in the Grafana server logs. Here is an example error where I haven’t built the JavaScript for a plugin so it couldn’t load:

EROR[03-31|17:27:09] Failed to start plugin                   logger=plugins.backend pluginId=grafana-oracle-datasource error="fork/exec /home/daniel/dev/go/src/github.com/grafana/plugins/oracle-datasource/dist/oracle-plugin_linux_amd64: no such file or directory"

Can you see an error in your logs?

The Chrome Dev Console gave me not more information about the Error and in the Grafana logs you can’t see any error. I think it is a more deep problem, because the panel work in Grafana v6.5.x but not anymore for v6.6.x and 6.7.x. This is more a little but confusing.

If there is no error in Grafana server logs, can you see a row that says the plugin is loaded?

Something like this:

INFO[04-01|11:56:00] Registering plugin                       logger=plugins name=Zabbix

Yes, this row i can see in my grafana log.

t=2020-04-02T08:38:15+0200 lvl=info msg="Registering plugin" logger=plugins name="Graph Panel Template"

Is this open source or available to test?

If you go to the plugins page: http://localhost:3000/plugins/

Do you see your Graph Panel Template plugin there? Can you go into the plugins page and see the plugin readme? (Example of a plugins page in Grafana: http://localhost:3000/plugins/prometheus/)

I developed features for a graph panel, based on this template: https://github.com/CorpGlory/grafana-graph-panel
In the plugins, i can see the plugin, but when i cannot see the readme.

Thanks, seeing the same thing when I try to load that plugin. It is getting pretty old so guess it some combination of node and npm packages that Grafana doesn’t like anymore. I will try and debug it and see what the issue is.

If you are building a new plugin, I’d recommend: https://grafana.com/tutorials/build-a-panel-plugin/#0 which uses the new toolkits that remove a lot of the boiler plate.

Ok - this is the underlying error:

"Unexpected token '<'
  Evaluating http://localhost:3000/public/vendor/flot/jquery.flot.pie.js

It got removed in January: https://github.com/grafana/grafana/commit/f93f1c4b51f00d380ba180c5b867140ba81761e3#diff-7d38adb6eb3fcc661871ef8d0968ffcf

Remove this line in your plugin and rebuild: https://github.com/CorpGlory/grafana-graph-panel/blob/master/src/graph.ts#L10

Thank you, now it works.

1 Like

Hello @daniellee, i’m writing again, because for the grafana-graph-panel from CorpGlory it worked, but for my version it didn’t work.
Do you can check this panel also ?

I got a bunch of errors when trying to build it.

When I used the shrinkwrap file:

ERROR in /home/daniel/dev/go/src/github.com/grafana/plugins/pw-graph-panel/node_modules/@types/grafana/index.d.ts
(15,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'System' must be of type 'any', but here has type '{ import: Function; }'.

When I installed the npm packages without using the shrinkwrap file:

ERROR in /home/daniel/dev/go/src/github.com/grafana/plugins/pw-graph-panel/node_modules/@types/grafana/index.d.ts
(15,5): error TS2717: Subsequent property declarations must have the same type.  Property 'System' must be of type 'any', but here has type '{ import: Function; }'.

ERROR in ./graph.ts
(853,29): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

ERROR in ./graph.ts
(857,17): error TS2554: Expected 1 arguments, but got 2.

Hello @daniellee, I worked today on this problem and it’s solved. You can compile now my panel without errors. The panel works again for Grafana 6.5.x, but not for Grafana 6.6.x and 6.7.x.