Custom Go plugin: invalid ELF header

Hi there

I’ve written a custom go plugin for kong, following the guide on the website. I’ve built the plugin locally on my machine with go1.15.5 with the command “go build -buildmode=plugin -o …/lib”. Then inside my docker container, I’m map a volume to the directory with the .so as my KONG_GO_PLUGINS_DIR env variable.

I’ve also extended with kong:ubuntu file with my own Dockerfile, which basically just installs go and the go-plugin-server. The go version inside the container is go1.15.5, which is the same version.

When I try to start up the container with docker-compose, I get the following error message:

2020/11/26 21:07:17 failed to open plugin kong-jwt-validation: plugin.Open("/go-plugins/libs/kong-jwt-validation.so"): /go-plugins/libs/kong-jwt-validation.so: invalid ELF header

Any ideas why this is happening and what I can do to get it fixed?

EDIT I tried with the test plugins that are provided here and I get the same result: https://github.com/Kong/go-plugins

Thanks

Okay, fixed this particular error. I was compiling the plugin on my local machine (mac) and then trying to use it inside the kong:ubuntu container. I needed to compile my plugin inside the same container that was going to be using it.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ