Old version of plugin loaded in development environment

Version: Grafana v11.1.0 (unknown-de)

Hi! When I try to test my plugin in development, I get an older version loaded up every time. I thought maybe there was a caching issue, but I followed the steps in Stop Caching Plugins in Development and I am still experiencing the issue.

When I start/restart Grafana using brew services restart grafana I see this plugin version loaded into Grafana:

My panels seem to be running that version (4.2.0) of the plugin as if it was frozen in time. For example, if I make a very obvious change (like throw an error before rendering anything), and rebuild the plugin then restart Grafana, nothing changes.

If I click “update”, the plugin will update to the latest version currently on the plugin marketplace (currently 4.3.2.) If I click “uninstall”, whether or not I updated first, I get Panel plugin not found: ventura-psychrometric-panel in my dashboards. After restarting Grafana, it goes right back to version 4.2.0.

How can I fix this? Where is this sneaky 4.2.0 version coming from? It must be cached somewhere. Thank you!


Here is the first few lines of my package.json:

{
  "name": "psychart",
  "version": "4.3.2b",
  "description": "View air conditions on a psychrometric chart",
  ...

I’ve also configured grafana.ini:

# Directory where grafana will automatically scan and look for plugins
;plugins = /var/lib/grafana/plugins
plugins = /Users/ventura/Documents/Code/grafana-plugins
# Enter a comma-separated list of plugin identifiers to identify plugins to load even if they are unsigned. Plugins with modified signatures are never loaded.
;allow_loading_unsigned_plugins =
allow_loading_unsigned_plugins = ventura-psychrometric-panel,ventura-pumpcurve-panel

This suggests to me that your Grafana server never finds the development version of your plugin.

What does the structure of this directory look like? Do you see any errors or warnings in the server logs when starting the Grafana server?

Not really related but you shouldn’t need to restart the Grafana server when making changes to a panel plugin unless you change the plugin.json file as that is held in memory when the server starts.

Additionally have you considered using the docker development env that comes with create-plugin?

I found this in the server logs, what would cause the system to think this plugin is a duplicate?

logger=plugin.signature.validator t=2024-07-22T10:15:25.684364-07:00 level=warn msg="Permitting unsigned plugin. This is not recommended" pluginId=ventura-psychrometric-panel
logger=plugins.registration t=2024-07-22T10:15:25.685868-07:00 level=info msg="Plugin registered" pluginId=ventura-psychrometric-panel
logger=plugins.dedupe t=2024-07-22T10:15:25.693618-07:00 level=warn msg="Skipping loading of plugin as it's a duplicate" pluginId=ventura-psychrometric-panel

It’s most likely due to the structure of the directory you’re using in your custom config ini.

plugins = /Users/ventura/Documents/Code/grafana-plugins

What does this Code/grafana-plugins directory look like? Does it contain your git repos for each of your plugins? If you want to run plugins that you’re developing in a grafana server you need to link only the dist directory into the grafana plugins directory. If you have the src and the bundled code in the plugins directory I think the server will get confused by the duplicated plugin.json files. Additionally if the development directory of your plugin has a different name to the plugin id and you have also installed your plugin via the plugins catalog (http://localhost:3000/plugins) you will have multiple copies of the plugin in the plugins directory. This is due to the Grafana application unpacking the plugin into a directory with the name of the plugin id.

For example, I set my custom ini plugins directory to something like:

plugins = /Users/jackwestbrook/data/plugins

then I do the following in terminal to create a symlink from my plugins dist directory into the plugins directory:

ln -s /Users/jackwestbrook/dev/sandbox/myorg-threejs-panel/dist /Users/jackwestbrook/data/plugins/myorg-threejs-panel
1 Like

It is a directory that looks like this, with each subfolder containing my project src/ and dist/. I haven’t had any issues in the past with it.

% pwd
/Users/ventura/Documents/Code/grafana-plugins
% ls -F
Psychart/	Pump-Curve/	Rawdata/	Simple/
% ls -F Psychart 
CHANGELOG.md		jest-setup.js		run*
LEGAL			jest.config.js		screenshots/
LICENSE			node_modules/		src/
README.md		package-lock.json	tsconfig.json
dist/			package.json		webpack.config.docs.ts
docker-compose.yaml	playwright.config.ts	webpack.config.icon.ts
docs/			provisioning/

However, your suggestion helped me figure out what the issue actually was. I had some hidden files that somehow got placed in my grafana-plugins/ directory that made Grafana think that directory itself was a plugin. (Somehow I must have accidentally moved a dist folder and some of the other configuration files into the base folder.)