Hi, I’m having a trouble building golang plugins using tykio/tyk-plugin-compiler:v5.2.1
and docker.tyk.io/tyk-gateway/tyk-gateway:v5.2.1-amd64
docker images. One of my imported package uses gopkg.in/square/go-jose.v2 v2.6.0
while tyk uses gopkg.in/square/go-jose.v2 v2.3.1
and it shows the following error:
tyk-gateway-tyk-gateway-1 | time="Oct 15 15:49:16" level=error msg="Could not load Go-plugin" error="plugin.Open(\"/opt/tyk-gateway/middleware/GolangPlugins_v5.2.1_linux_amd64.so\"): plugin was built with a different version of package gopkg.in/square/go-jose.v2/cipher (previous failure)" mwPath=/opt/tyk-gateway/middleware/GolangPlugins.so mwSymbolName=Auth
It runs normally when I removed the conflicting package. Some things that I tried:
-
Manually change the tag to v2.3.1, it automatically reverts back to v2.6.0 when doing go mod tidy
-
Add replace on plugin’s go module
replace gopkg.in/square/go-jose.v2 v2.6.0 => gopkg.in/square/go-jose.v2 v2.3.1
, but it still shows the same error -
Clone Tyk gateway v5.2.1 repo GitHub - TykTechnologies/tyk at release-5.2.1 and use the code as the container source (also tried removing the
image: internal/tyk-gateway
command on docker-compose.yml so it builds from local Dockerfile), but it shows a fatal errorfatal error: runtime: no plugin module data
. similar error also occured when I’m using v4.x gateway with v5.x plugin compiler.
As for the 3rd point, I’m not sure whether I’m building the container correctly or not, because by default, when running docker-compose up
it shows a log saying v4.3.0 Tyk API Gateway v4.3.0
. When I remove this line image: internal/tyk-gateway
, it shows the correct version but it still behave the same way.
Is there any alternative that I could try or is there any mistakes that I did when building the container?
Thanks