Branch/Environment/Version
- Branch/Version: Release v5.2.5
- Environment: On-prem (OSS)
Describe the bug
We try to register a Golang plugin, using enable_bundle_downloader
, as described here.
Unfortunately, this does not work, as the driver information in the manifest.json
is not considered at all, and it is interpreted as a coprocess
plugin.
Reproduction steps
Steps to reproduce the behaviour:
- Configure Tyk to disable
coprocess_options.enable_coprocess.
plugin, but enableenable_bundle_downloader
(with according URL) - Create, build and publish a simple Golang plugin (e.g.
pre
, just adding a static header) - Create an API with
custom_middleware_bundle
using the above bundle
Actual behaviour
The gateway starts up, but complains about us trying to register a CP plugin while this is disabled:
Your API specifies a CP custom middleware, either Tyk wasn't build with CP support or CP is not enabled in your Tyk configuration file!
The plugin is (not surprigingly) not working as a result.
When getting the API definition via the gateway API, the custom_middleware
block contains an empty string for the driver
key, while in the manifest.json
, it is set to goplugin
.
Expected behaviour
The goplugin
driver entry from the manifest will be respected, and the plugin should be registered & working.
Screenshots/Video
not applicable
Logs (debug mode or log file):
time="Jan 04 15:06:36" level=debug msg="----> Saving Bundle: TestPlugin.zip" prefix=main
time="Jan 04 15:06:36" level=info msg="----> Loading bundle: TestPlugin.zip" prefix=main
time="Jan 04 15:06:36" level=info msg="----> Verifying bundle: TestPlugin.zip" prefix=main
time="Jan 04 15:06:36" level=info msg="----> Bundle verification failed: TestPlugin.zip" prefix=main
time="Jan 04 15:06:36" level=info msg="----> Bundle is valid, adding to spec: TestPlugin.zip" prefix=main
time="Jan 04 15:06:36" level=info msg="Detected 1 APIs" prefix=main
time="Jan 04 15:06:36" level=info msg="Loading API configurations." prefix=main
time="Jan 04 15:06:36" level=info msg="Tracking hostname" api_name="Test backend" domain="(no host)" prefix=main
time="Jan 04 15:06:36" level=info msg="Initialising Tyk REST API Endpoints" prefix=main
time="Jan 04 15:06:36" level=debug msg="Loaded API Endpoints" prefix=main
time="Jan 04 15:06:36" level=info msg="API bind on custom port:0" prefix=main
time="Jan 04 15:06:36" level=debug msg="Initializing API" api_id=1 api_name="Test backend" org_id=default
time="Jan 04 15:06:36" level=debug msg="Loading custom PRE-PROCESSOR middleware: TestPlugin" prefix=main
time="Jan 04 15:06:36" level=debug msg=Init api_id=1 api_name="Test backend" mw=VersionCheck org_id=default
time="Jan 04 15:06:36" level=debug msg="Registering coprocess middleware, hook name: TestPluginhook type: Pre, driver: " api_id=1 api_name="Test backend" org_id=default prefix=coprocess
time="Jan 04 15:06:36" level=error msg="Your API specifies a CP custom middleware, either Tyk wasn't build with CP support or CP is not enabled in your Tyk configuration file!" prefix=coprocess
Configuration (tyk config file):
No config file, since running in Kubernetes using the Helm chart. Relevant environment variables:
TYK_GW_MIDDLEWAREPATH: /mnt/tyk-gateway/middleware
TYK_GW_HTTPSERVEROPTIONS_ENABLEHTTP2: true
TYK_GW_HTTPSERVEROPTIONS_FLUSHINTERVAL: 1
TYK_GW_PROXYENABLEHTTP2: true
TYK_GW_LOGLEVEL: debug
TYK_GW_ENABLEBUNDLEDOWNLOADER: true
TYK_GW_BUNDLEBASEURL: ttp://bundle-server.default.svc.cluster.local/bundles/
TYK_GW_BUNDLEINSECURESKIPVERIFY: true
TYK_GW_COPROCESSOPTIONS_ENABLECOPROCESS: false
Additional context
Looking at the code base, it seems to me that bundle downloader is only working for coprocess
anyway, since the only place in the code where the config property is read is in gateway/coprocess_bundle.go
.
But the docs linked above clearly state that this should work for goplugin
driver also.