Missing Module.js in SQLDB plugin

Hi all,

I was attempting to install the SQLDB plugin (to make my Grafana installation work with Postgresql), but I couldn’t and noticed in the console a file was being attempted to load - module.js. It was missing from the plugin directory, obviously, and checked the other plugin directories to see why they work and this one doesn’t. It checks out, module.js was simply missing, so I decided to attempt to install your example datasource plugin:

However, even there the module.js file is simply missing, and the documentation is being rather vague about the module.js file (or perhaps it’s simply because I have never worked with such an environment before, hmmm…) - or rather, files… Apparently these files are the entry point of the plugin, but what I do wonder is why are they missing from the example plugin, even? Do I need to build it myself somehow? If so, I’m rather short of time at the moment, because I’m nearing my deadline - I do not have time to investigate all the necessary steps. I was hoping it’d be a drag-and-drop process (of course, things never work out that easily :stuck_out_tongue: )

Anyhow, I’m sorry if this question has been answered before or if it’s a rookie question. You have my thanks for reading this far either way! :slight_smile:

How did you install the plugin?

  • Here is a guide to installing plugins manually.
  • Here is how to install the SimpleJSON plugin via the CLI tool.

There is a module.js file for the SimpleJSON data source : https://github.com/grafana/simple-json-datasource/blob/master/dist/module.js

so I’m not really sure why it is missing in your case.

1 Like

Thanks for the reply!

I installed both plugins manually by downloading their respective github projects as a .zip file, then extracting them into the plugins folder. I should state me attempting to install SimpleJSON was merely a test.

The SQLDB datasource plugin:
https://github.com/sraoss/grafana-sqldb-datasource

  • That project has a module.js so how can it be missing after you downloaded it?
  • After extracting the files, does the path to module.js look like this: data/plugins/grafana-sqldb-datasource/dist/module.js?
  • Did you remember to restart your Grafana server after copying in the files?
  • can you show the error from the Grafana logs.

It seems the system was attempting to load the files from the root of the plugin, unless this is intended behaviour and I’m using an older version or something, hence the file disrespecancies. So it did have the module.js all along, I was confused by the other plugins that had the module.js, along with the other files, in the root folder.

Seems like copying the files from /dist to the root of the plugin folder “”“worked”"", because the plugin is properly loading, at the very least. I suppose this is an extremely crude solution though, because now I am getting the following error when attempting to save the new data source:

Unknown error
Cannot read property ‘indexOf’ of undefined

All the browser console spits out is the following:
boot.js:42 POST http://localhost:8080/api/datasources/proxy/2/query 502 (Bad Gateway)
I’m confused at this, because the error I am receiving from the Grafana interface does not appear to be related to the browser console error at all. Or perhaps it is due to the Bad Gateway… time to investigate my configuration.

I guess my installation is held together by rope and duct tape at this point… :sweat:

Bah, I feel so stupid right now.
I should state that I can send data to my PostgresDB, because I’m using a Node-RED installation that is connected to the database. The last row was created at 16:47:06, which as of writing is 30 seconds ago. Why Grafana has trouble connecting to the database… I simply have no idea.

Sorry, I don’t really know. It is not a published plugin (and therefore has never been reviewed by anyone on the Grafana team) - so I have never used it. Maybe you can submit an issue to their GitHub repo.

Grafana loads the files in the dist folder if it exists otherwise it loads the files from the plugin root. So your solution of just copying in the dist files should work fine in theory.

I decided to retry InfluxDB again, and now it’s all good. Thank you for your support - really appreciate the quick responses! Keep up the good work, guys :slight_smile: