It seems that Tyk behaves differently when loading analytic_plugin compared to custom_middleware plugins, especially concerning the plugin filename.
when configuring the path for a custom_middleware plugin for modifying requests or responses, Tyk successfully loads the plugin despite having a different file name. For instance:
Even if the file is named something like
However, I didn’t get the same result when attempting the same process with an analytic plugin:
In this scenario, Tyk fails to load the file.
Any idea? Thanks in advance.
Could you share the error you get? Try looking for logs with
Here is the error:
Could not load Go-plugin for analytics" error="plugin.Open(\"/opt/tyk-hybrid/middleware/go-plugins.so\"): realpath failed" mwPa>
The same path is used for request body transform custom plugin, and the plugin can be loaded. But somehow, it can not be loaded fo the analytic_plugin case.
To answer your earlier question about the different behaviours, yes they are loaded differently. The request and response chain use the GetPluginFileNameToLoad to load plugins. While the analytics chain uses the file path.
That aside, your error implies that the plugin is not found in the path.
When I tried to load I got a different error. I review this with a few folks internally.
level=error msg="Could not load Go-plugin for analytics" error="plugin.Open(\"/opt/tyk-gateway/middleware/analytics_plugin\"): plugin was built with a different version of package github.com/TykTechnologies/storage/persistent/model" mwPath=/opt/tyk-gateway/middleware/analytics_plugin.so mwSymbolName=MyAnalyticsPluginDeleteHeader
In the meantime, can you share how you are building the plugin and also the contents of your plugin? Anything you share would be helpful in reproducing the issue.