Custom datasource error during test

I’m having an issue with my datasource plugin
This hasn’t been signed so we are adding the flag in Docker

GF_DEFAULT_APP_MODE: development

Locally if I point it to my drive using


  • my_local_dist_folder:/var/lib/grafana/plugins

I don’t see the error

But when I push it and use the url for the .zip file and try to install the plugin via GF_INSTALL_PLUGINS:https://path_to_zip;my-plugin

and I try to add the new datasource in grafana 9+ or 8+ I get the following error

actions.ts:111 Uncaught (in promise) {message: ‘Datasource: Www7qPbVz was not found’}
(anonymous) @ actions.ts:111
await in (anonymous) (async)
(anonymous) @ index.js:16
n. @ bindActionCreators.js:9
testDataSource @ DataSourceSettingsPage.tsx:152
(anonymous) @ DataSourceSettingsPage.tsx:98

I can’t seem to understand the reason why I keep getting this error.
Clearly the oid Www7qPbVz can’t be mapped to the datasource for some reason but I don’t know why.
It works fine when I do the same steps locally except for this 2 line in docker-compose

GF_INSTALL_PLUGINS:https://<path_to_zip>; (here fails)


  • :/var/lib/grafana/plugins (here works)

Any ideas?

What do you mean by “push it” here?

What url are you using for this?

Are you combining both using a volume to load a local plugin and GF_INSTALL_PLUGINS to install it from a remote source?

@grafanad404 OK, so ended finding the error occurs when I build the plugin.
I generally use npm run dev or npm run watch commands and let out CD/CI do the build .
But now we have been just migrating into react and we are trying to do some user testing but I’m stuck trying to get a working build.

As soon as I run npm run build command I see the error. This happens when I try to configure the datasource btw.

Also I need to mention we are using grafana-toolkit (I tried switching to webpack but I found the same result, although with webpack I see the same behavior for build or dev scripts)

I’m sure I’m missing something here because we recreated 3 angular datasources in react but never really did a build until now. We have just been using dev.

Any ideas what could be happening here?

@aramosvizcarra I strongly recommend you to migrate from toolkit to create-plugin as we deprecated toolkit and won’t be giving more support on it.

Both toolkit and create-plugin use webpack.

It will be very hard to help you debug your problem without access to the source code. If I understand you correct the datasource works when you build using development mode but it won’t work in production?

I generally use npm run dev or npm run watch commands and let out CD/CI do the build

I am a bit confused with this statement. Do you run npm run dev in CI? What CI are you using? Github actions? Drone? something custom? You should always build with production in your CI and only use dev in development. npm run dev will start a watch server and will make your CI hang.

My best guess so far is that you have some incorrect configuration in your plugin.json or you have special custom configurations in webpack or babel. To me it looks like build process is changing your plugin.json id. See the result of your plugin.json when you build it with dev and when you run it with build. Check the names and ids are the same.

Take a look at the datasource example and compare it to what you have. (this example uses create-plugin). Maybe even try to run this example datasource yourself and see if you get problems, to discard this is not a problem in your environment or grafana install.

Thanks for the suggestion @grafanad404 I tried it but I still get the same error

OK I think I found the cause this time…the Datasource contructor use 3 args instead of just one as the react example…

constructor(instanceSettings: DataSourceInstanceSettings<EntityDataSourceOptions>, public backendSrv: any, public templateSrv: any)

Could be that backendSrv, and templateSrv used ot be part of angular framework?

Feel free to access the code under this branch GitHub - OpenNMS/opennms-helm at helm-react-poc-test-build

So looks like I need to use DataSourceWithBackend instead …