Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin v0.2.7 and Traefik v2.7+ panic due to reflect.Set #41

Closed
Michaelhobo opened this issue Mar 23, 2023 · 5 comments
Closed

Plugin v0.2.7 and Traefik v2.7+ panic due to reflect.Set #41

Michaelhobo opened this issue Mar 23, 2023 · 5 comments
Labels
bug/confirmed Something isn't working

Comments

@Michaelhobo
Copy link

I'm getting the following error when running htransformation plugin with Traefik v2.7+:

src/github.com/tomMoulard/htransformation/htransformation.go:40:3: panic

Error in Go routine: reflect.Set: value of type map[string]*interp.node is not assignable to type map[string]func(http.ResponseWriter, *http.Request, struct { Header string \"yaml:\\\"Header\\\"\"; HeaderPrefix string \"yaml:\\\"HeaderPrefix\\\"\"; Name string \"yaml:\\\"Name\\\"\"; Regexp *regexp.Regexp \"yaml:\\\"-\\\"\"; Sep string \"yaml:\\\"Sep\\\"\"; Type string \"yaml:\\\"Type\\\"\"; Value string \"yaml:\\\"Value\\\"\"; ValueReplace string \"yaml:\\\"ValueReplace\\\"\"; Values []string \"yaml:\\\"Values\\\"\"; SetOnResponse bool \"yaml:\\\"SetOnRequest\\\"\" })

This looks pretty similar to the error in #39

@tomMoulard tomMoulard added the bug/possible Something seems to not work label Mar 23, 2023
@tomMoulard
Copy link
Owner

I need to reproduce this on my own, but it looks like an error on Yaegi's side.

@tomMoulard
Copy link
Owner

@Michaelhobo, I am sorry, but I cannot reproduce your issue. Can you provide a reproducible use case, using the docker-compose.yaml example file provided in the repository, for example ?

@tomMoulard tomMoulard added contributor/waiting-for-feedback Feedback from the contributor is needed contributor/need-more-information Information from the contributor is needed in order to analyze a problem and removed contributor/waiting-for-feedback Feedback from the contributor is needed labels Mar 23, 2023
@Michaelhobo
Copy link
Author

Here is the docker-compose.yml file I used

version: '3.9'

services:
  traefik:
    image: traefik:v2.7
    command:
      - --api.insecure=true
      - --providers.docker
      - --providers.file.filename=/rules-htransformation.yaml
      - --log.level=DEBUG
      - --experimental.plugins.htransformation.moduleName=github.com/tomMoulard/htransformation
      - --experimental.plugins.htransformation.version=v0.2.7
    ports:
      - 9000:80
      - 9001:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./rules-htransformation.yaml:/rules-htransformation.yaml
      - .:/plugins-local/src/github.com/tomMoulard/htransformation/
    tty: true

  whoami:
    image: traefik/whoami # https://github.com/traefik/whoami
    command: -name whoami
    labels:
      traefik.http.routers.whoami.rule: Host(`whoami.localhost`)
      traefik.http.routers.whoami.middlewares: htransformation@file

Here's the log from running docker compose up: https://gist.github.com/Michaelhobo/b2dff45b9391168f7cb0bbf6db4eb801

@Michaelhobo
Copy link
Author

Also to clarify, we haven't done the Traefik v3 migration yet, so what I mean by "v2.7+" is really "v2.7 <= x < v3.0".

I ran this again with traefik:v3.0, and it does not have that error.

@tomMoulard
Copy link
Owner

It seems to be fixed in v2.9 by updating yaegi to include fixes (like this one: traefik/yaegi#1447), so you might want to use traefik v2.9+.

@tomMoulard tomMoulard added bug/confirmed Something isn't working and removed bug/possible Something seems to not work contributor/need-more-information Information from the contributor is needed in order to analyze a problem labels Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants