Error 404 not found instanting for my plugin

Hello,

I’m on 9.5.2, and i have this error since i want to be in production mode and not developer mode, did anyone know how to make my plugin work in a production mode ?

To run your plugins in production mode your plugin must be signed. See information about how to sign your plugin if you wish your plugin to be available in the grafana catalog you’ll want to go through the review process

1 Like

Hello,

What i am supposed to put here :

--rootUrls https://example.com/grafana

@academo

In the sign a plugin documentation:

  • After the rootUrls flag, enter a comma-separated list of URLs for the Grafana instances where you intend to install the plugin.

E.g. if you plan to run your grafana instance in https://nicolasdossantos248.com then you should use that. If you plan to have more instances in different domains, you can specify them comma, separated,. e.g. https://nicolasdossantos248.com,https://grafana.nicolasdossantos248.com,https://nicolasdossantos248.com/mygrafana. etc… Note it expects the complete URL including protocol, hostname and path (if any)

Thank you for the explanation but it doesn’t work i still get the error

my Manifest :


export GRAFANA_API_KEY=<MYAPIKEY>
npx @grafana/sign-plugin@latest --rootUrls http://grafana.staged-by-discourse.com

What error are you getting after signing?

Can you see the MANIFEST.txt file in your dist folder of your plugin?

I tried an example plugin in a local instance and it accepted the private signature.

I got the same error as before :

# Fetch error: 404 Not Found Instantiating http://grafana.staged-by-discourse.com/public/app/plugins/datasource/dist/module Loading app/plugins/datasource/dist/module

And when I yarn build my plugin this don’t create a manifest so i create one with the code i show in my precedent message

can you share a code repository with your plugin to try to reproduce the error? additionally:

  • how are you running grafana? (e.g. docker, clone from source, binary, etc…)
  • can you share your custom.ini file?
  • did you restart your grafana server after signing?

I create repo, here is a link :

The default.ini is on the repo
I am running grafana enterrise on windows with visual.
Yes i restart my server each time.

Hi. Could you share your custom.ini if you have one. (not the default.ini)

Hi @nicolasdossantos248 I gave a try to your plugin and it worked just as expected for me.

I signed it privately for a locahost domain and it shows up and loads (the plugin functionality is to show the user’s webcam)
image

I ran the grafana server locally from code in production mode and I also run it from the docker-compose in the code you sent me with a small modification to run it in production (see at the end)

I suspect the problem comes from how you are running grafana or your specific configuration and not from the plugin build, code or signature. In such case I advice you to try to run grafana differently, directly from the terminal, not from other program UI.

Run grafana with docker for your plugin

To run grafana in production mode using the docker-compose.yml file (that comes with your plugin files) you need to add the following section under the grafana section

  environment:
      - GF_DEFAULT_APP_MODE=production

Do make sure to comment this section when you keep developing your plugin so it goes back to development mode or grafana will refuse to load your plugin if you change the sourcecode while in production mode.

It should look like this at the end

version: '3.0'

services:
  grafana:
    container_name: 'helios-videov3-panel'
    build:
      context: ./.config
      args:
        grafana_version: ${GRAFANA_VERSION:-9.2.5}
    environment:
      - GF_DEFAULT_APP_MODE=production
    ports:
      - 3000:3000/tcp
    volumes:
      - ./dist:/var/lib/grafana/plugins/helios-videov3-panel
      - ./provisioning:/etc/grafana/provisioning

Then you can run the regular docker-compose up to start the server.

I don’t have a custom.ini

Thank you, I will try to use docker and I come back to you.

Well, I try it but my plugin don’t appear in the list of my plugin.

First I create a dist file with a MANIFEST.txt :

export GRAFANA_API_KEY=<MYAPIKEY>
npx @grafana/sign-plugin@latest --rootUrls http://grafana.staged-by-discourse.com

Then I modify my docker-compose like this :

version: '3.0'

services:
  grafana:
    container_name: 'helios-videov3-panel'
    build:
      context: ./.config
      args:
        grafana_version: ${GRAFANA_VERSION:-9.2.5}
    environment:
      - GF_DEFAULT_APP_MODE=production
      - GF_DASHBOARDS_MIN_REFRESH_INTERVAL=0.1s
      - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=true
    ports:
      - 3000:3000/tcp
    volumes:
      - ./dist:/var/lib/grafana/plugins/helios-videov3-panel
      - ./provisioning:/etc/grafana/provisioning

To finish I Made a docker-compose up.

What did I do wrong ? And can you explain which file in which path ? and in which path you run docker-compose up ?

When you start your container you will see a log. Take a look at that log and look for errors regarding to plugins.

Hello, I don’t have error

Take a closer look. Even if no errors you will see logs related to plugins.

Did this error can have something to do with the fact that my plugin aren’t signed ?

logger=provisioning.datasources t=2023-07-10T10:21:27.841335285Z level=error msg="can't read datasource provisioning files from directory" path=/etc/grafana/provisioning/datasources error="open /etc/grafana/provisioning/datasources: no such file or directory"
logger=provisioning.plugins t=2023-07-10T10:21:27.842090387Z level=error msg="Failed to read plugin provisioning files from directory" path=/etc/grafana/provisioning/plugins error="open /etc/grafana/provisioning/plugins: no such file or directory"
logger=provisioning.notifiers t=2023-07-10T10:21:27.842596388Z level=error msg="Can't read alert notification provisioning files from directory" path=/etc/grafana/provisioning/notifiers error="open /etc/grafana/provisioning/notifiers: no such file or directory"
logger=provisioning.alerting t=2023-07-10T10:21:27.843190889Z level=error msg="can't read alerting provisioning files from directory" path=/etc/grafana/provisioning/alerting error="open /etc/grafana/provisioning/alerting: no such file or directory"```

No. Those errors are about provisioning and can be ignored if you are not doing anything with provisioning.

I tested exactly the same docker-compose file you pasted here (no modifications) with the previously provided zip file in two scenarios:

  1. Signed plugin (with community.grafana.com rootUrl). Works as expected. The plugin is loaded and appears in the plugin list.
  2. Unsigned plugin. The plugin doesn’t load and won’t appear in the plugin list. The following error appears in the start log:
logger=plugin.loader t=2023-07-10T11:26:28.960408046Z level=warn msg="Skipping loading plugin due to problem with signature" pluginID=helios-videov3-panel status=unsigned

Check your log output for similar errors in the plugin.loader.

is there any specific reason you are trying to sign the plugin at this stage? if you are developing the plugin you don’t need to sign it, you can set grafana in development mode and it’ll load unsigned plugins. To do that set GF_DEFAULT_APP_MODE=development

Well it works, I still can’t signed my plugin but it will be fine.

I want to than you a lot for you time, you helped me a lot.

Nicolas