Tyk Gateway Could not load Go-plugin

Hi,

I am using docker compose to deploy Tyk Opensource Gateway v5.5.0, and it is running. I also used tyk-plugin-compiler:v5.5.0 to generate some Go-plugin binary and placed them at this middleware folder.

Some plugin functions can be loaded, and it is working normally.

However, I noticed that some of the plugin functions could not be loaded. When I checked the logs from Tyk gateway, I saw some error message like this:

time=“Feb 15 03:23:14” level=info msg=“API bind on custom port:0” prefix=main
time=“Feb 15 03:23:14” level=debug msg=“Initializing API” api_id=ndi2-adminapi api_name=ndi2-adminapi org_id=1
time=“Feb 15 03:23:14” level=debug msg=“Loading custom PRE-PROCESSOR middleware: MyPluginFunction” prefix=main
time=“Feb 15 03:23:14” level=info msg=“Checking security policy: Open” api_id=ndi2-adminapi api_name=ndi2-adminapi org_id=1
time=“Feb 15 03:23:14” level=debug msg=Init api_id=ndi2-adminapi api_name=ndi2-adminapi mw=VersionCheck org_id=1
time=“Feb 15 03:23:14” level=error msg=“Could not load Go-plugin” error=“plugin.Open("/opt/tyk-gateway/middleware/ndi2AdminAPI2_v5.5.0_linux_amd64.so"): plugin already loaded (previous failure)” mwPath=/opt/tyk-gateway/middleware/ndi2AdminAPI2.so mwSymbolName=MyPluginFunction

The error message said that “Could not load Go-plugin” error=“plugin.Open("/opt/tyk-gateway/middleware/ndi2AdminAPI2_v5.5.0_linux_amd64.so"): plugin already loaded (previous failure)” mwPath=/opt/tyk-gateway/middleware/ndi2AdminAPI2.so mwSymbolName=MyPluginFunction".

I have some .so files, and they have the same function name called “MyPluginFunction”.

But I am sure that I have put this ndi2AdminAPI2.so (when compiled, the filename is ndi2AdminAPI2_v5.5.0_linux_amd64.so) at the middleware folder, and this plugin has a function call “MyPluginFunction”. I also defined it at the custom_middleware section when I created the API.

I used this command to generate the plugin binary:

docker run --rm -v pwd:/plugin-source tykio/tyk-plugin-compiler:v5.5.0 ndi2AdminAPI2.so

What is the reason for this “Could not load Go-plugin” error? Do I missed any step?

Regards,

Maan Tarng