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

cannot import github.com/IBM/sarama #10705

Open
2 tasks done
wubonetcn opened this issue May 9, 2024 · 3 comments
Open
2 tasks done

cannot import github.com/IBM/sarama #10705

wubonetcn opened this issue May 9, 2024 · 3 comments

Comments

@wubonetcn
Copy link

wubonetcn commented May 9, 2024

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

I want to write a plugin for Traefik and need to send the content through Kafka, but I got an error when importing the Kafka package, here is my code.

package pluginmirror2kafka

import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"sync"
	"text/template"

	"github.com/IBM/sarama" 
)
traefik --configFile=traefik.yml
2024-05-09T04:14:00-04:00 ERR Plugins are disabled because an error has occurred. error="failed to create Yaegi interpreter: failed to import plugin code \"github.com/traefik/pluginmirror2kafka\": 1:21: import \"github.com/traefik/pluginmirror2kafka\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/github_com-IBM-sarama.go:7:2: import \"github.com/IBM/sarama\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/IBM/sarama/compress.go:9:2: import \"github.com/klauspost/compress/gzip\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/klauspost/compress/gzip/gunzip.go:17:2: import \"github.com/klauspost/compress/flate\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/klauspost/compress/flate/stateless.go:193:43: cannot use type int16 as type int32 in struct literal"

What did you see instead?

I'm seeing an error message that the plugin is not working properly

What version of Traefik are you using?

traefik version
Version:      3.0.0
Codename:     beaufort
Go version:   go1.22.2
Built:        2024-04-29T14:25:59Z
OS/Arch:      linux/amd64

What is your environment & configuration?

experimental:
  localPlugins:
    example:
      moduleName: github.com/traefik/pluginmirror2kafka

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

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://localhost
  
  middlewares:
    pluginmirror2kafka:
      plugin:
        kind: Middleware
        config:
          kafka:
            brokers:
              - "kafka-broker1:9092"
              - "kafka-broker2:9092"
            topic: "my-topic"

Add more configuration information here.

If applicable, please paste the log output in DEBUG level

traefik --configFile=traefik.yml --log.level=DEBUG
2024-05-09T04:19:17-04:00 ERR Plugins are disabled because an error has occurred. error="failed to create Yaegi interpreter: failed to import plugin code \"github.com/traefik/pluginmirror2kafka\": 1:21: import \"github.com/traefik/pluginmirror2kafka\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/github_com-IBM-sarama.go:7:2: import \"github.com/IBM/sarama\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/IBM/sarama/compress.go:9:2: import \"github.com/klauspost/compress/gzip\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/klauspost/compress/gzip/gunzip.go:17:2: import \"github.com/klauspost/compress/flate\" error: plugins-local/src/github.com/traefik/pluginmirror2kafka/vendor/github.com/klauspost/compress/flate/stateless.go:193:43: cannot use type int16 as type int32 in struct literal"
@ldez
Copy link
Member

ldez commented May 9, 2024

The related Yaegi issue traefik/yaegi#1630

@wubonetcn
Copy link
Author

wubonetcn commented May 9, 2024

Yes, I also raised this issue, so I asked here because no one solved it.

@wubonetcn
Copy link
Author

Obviously, the traefik/traefik answer should be a little more positive.I hope to be able to solve the problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants