alexandrainst / alexandra-trackmap-panel

Grafana map plugin to visualise coordinates as markers, hexbin, ant path, or heatmap.
MIT License
77 stars 26 forks source link

[Plugin file not found] Missing images for markers, etc. #106

Closed jkscx closed 1 year ago

jkscx commented 1 year ago

TLDR: The latest plugin version has a small bug which prevents the markers from being displayed on the map. I have traced the issue to a recent commit in which someone forgot to check in the marker images after changing their names in the code. Could provide a PR (if one can call it even that) where I check in the relevant marker images if you are willing to accept it.


Longer explanation: Running the latest plugin version gives an "soft" error with error message (I have highlighted the important parts):

"logger=context userId=1 orgId=1 uname=admin t=2023-03-25T17:49:57.809355301Z level=error msg="Plugin file not found" error="open /var/lib/grafana/plugins/alexandra-trackmap-panel/dist/img/146420bd327a9001c77f.png: no such file or directory" traceID="

This doesn't stop the plugin from working, but the markers don't show up on the map, instead there is a small "Marker" text instead of the actual PNG and if one opens the browser console one can see a 404 Not Found error for GET http://localhost:3000/public/plugins/alexandra-trackmap-panel/img/146420bd327a9001c77f.png. As the only thing which isn't displayed is the marker and this file ends with .png I have concluded that this file is the missing marker image.

Searching for the string "146420bd327a9001c77f.png" in the git repo gives us the commit which introduced it on Feb 22.

$ git log -S146420bd327a9001c77f.png
commit 57229788af14c5e00b4dd44f5b8681fe345fa244
Author: Antti Seppälä <a.seppala@gmail.com>
Date:   Wed Feb 22 16:57:59 2023 +0200

    Update react-leaflet and dependencies (#101)

https://github.com/alexandrainst/alexandra-trackmap-panel/blob/57229788af14c5e00b4dd44f5b8681fe345fa244/dist/module.js#L22777

This commit has the problem that it changed the marker image filename in the code but didn't add the actual referenced file. Seems to me like the TS-to-JS compiler/bundler started mangling image names all of a sudden and the person who did the above commit/PR did not notice this and didn't add the mangled marker images to the commit.

And sure enough, after one git clones the latest version of the plugin, builds it for production, and runs git status one can see the missing mangled marker (and other) images under "Untracked files'.

$ git status
On branch master
Your branch is up to date with 'origin/master'.
[...]

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    dist/img/0777d2a4451a511591d3.png
    dist/img/146420bd327a9001c77f.png
    dist/img/2b3e1faf89f94a483539.png
    dist/img/416d91365b44e4b4f477.png
    dist/img/8f2c4d11474275fbc161.png

I have also verified that if one manually changes the filenames of the markers in the /dist/img/ folder to the mangled versions that then the markers also appear on the map.

If you want I could provide a PR which checks in the relevant images and increases the plugin version.

rudibroekhuizen commented 1 year ago

I noticed the same issue. Would be nice if this can be resolved.

image