Create and test local plugin Error

Hi,
I'm trying to test my local plugin , and I get an error:

{“entryPointName”:“web”,“level”:“error”,“msg”:“plugin: unknown plugin type: requestid”,“routerName”:“backend-router@file”,“time”:“2023-03-15T16:08:10Z”}

Metadata:
Traefik version: 2.9.5
plugin name: requested
location: plugins-local/src/github.com/traefik/requestid
.traefik.yaml:

displayName: Request ID
type: middleware
import: github.com/traefik/requestid
summary: Adds a header to incoming requests

testData: {}

middleware config:

http:
      middlewares:
        requestid:
          plugin:
            requestid: {}

    experimental:
      localPlugins:
        requestid:
          moduleName: github.com/traefik/requestid

Hello,

I think you have mixed static configuration and dynamic configuration.

And your module name should not contain github.com/traefik/

Take a look at the documentation:

can you please help me focus on what should I change,
my configuration looks exactly like described in the local mode example that you mentioned

The dynamic configuration and the static configuration must be defined in separated files:

# Static configuration (traefik.yml)

experimental:
  localPlugins:
    example:
      moduleName: <your module name>
# dynamic configuration (related to the path of the file provider)

http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        - web
      middlewares:
        - my-plugin

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://127.0.0.1:5000
  
  middlewares:
    my-plugin:
      plugin:
        example:
          <the configuration of your plugin>

the configuration is correct, is it just the place I've put it?
I use the traefik helm chart to deploy it, can you relate me to the appropriate place for the experimental ?

In the docs they uses Traefik Labs · GitHub also

Thank you for your help :pray: !

experimental is not a subset of http: the http configuration is a part of the dynamic configuration, and experimental is a part of the static configuration.

additionalArguments:
  - "--experimental.localPlugins.example.moduleName=<your module name>"

The documentation uses a module name with github.com/traefik/ because it's our own plugin.
I wrote the documentation, I wrote the demo plugin, and I also wrote the plugin system :wink:

hahaha, the best person to ask! (:
I thought the URL prefix in github is mandatory (traefik in path or anything else does not matter I guess )
deployment parameter

plugins file:

    http:
      middlewares:
        requestid:
          plugin:
            requestid: {}

error:

please stop using our base module name (github.com/traefik/), it will work but it's a bad practice.

Can you provide all your Traefik configurations?

traefik --entrypoints.metrics.address=:9100/tcp 
--entrypoints.traefik.address=:9000/tcp 
--entrypoints.web.address=:8000/tcp 
--entrypoints.websecure.address=:8443/tcp
 --api.dashboard=true --ping=true 
--metrics.prometheus=true 
--metrics.prometheus.entrypoint=metrics 
--entrypoints.websecure.http.tls=true 
--log.format=json --log.level=DEBUG 
--providers.file.directory=/etc/traefik 
--providers.file.watch=false 
--api.insecure=true 
--experimental.localPlugins.requestid.moduleName=github.com/traefik/requestid

can you also provide the logs?

I looked into the logs and found the last issue

  • .traefik.yml (file extension typo) :slight_smile:

It works, thank you!!! :pray:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.