Python bundles get purged after reloading endpoints

Hi Martin,

I’m running into this exact same problem of middleware getting purged after API reload. Is this issue already fixed? I checked https://github.com/lonelycode/tyk_quickstart.git but didn’t see any updated fix.

Does the patch you mentioned above fix this issue? I’m not seeing the exception stack trace mentioned on that thread.

Now the weird thing is at some point on my set up, I was able to get this python plugin working. Then I switched to java based gRPC plugin and when I switched back to python based plugin, it stopped working. I re-deployed the tyk containers and now I’m stuck with this issue where the python plugin keeps getting un-deployed.

I’m running Tyk containers on Docker similar to the setup mentioned on this post. Any idea how to fix this? If the fix is not available yet, is there a work-around? Please see log below.

Thanks,
-Jeffrey

time=“Oct 11 16:54:12” level=info msg=“Processed and listening on: /portal-assets/{rest:.}"
time=“Oct 11 16:54:12” level=info msg="Processed and listening on: /portal-api/{rest:.
}”
time=“Oct 11 16:54:12” level=info msg=“Processed and listening on: /test-api/{rest:.}"
time=“Oct 11 16:54:12” level=info msg="Processed and listening on: /portal/{rest:.
}”
time=“Oct 11 16:54:12” level=info msg=“Loading uptime tests…”
time=“Oct 11 16:54:12” level=info msg=“Initialised API Definitions”
time=“Oct 11 16:54:12” level=info msg=“API reload complete”
time=“Oct 11 16:54:12” level=info msg=“Initiating coprocess reload”
time=“Oct 11 16:54:12” level=info msg=“Reloading middlewares”
time=“Oct 11 16:54:12” level=info msg=“Reloading event handlers and middlewares.”
time=“Oct 11 16:54:52” level=info msg=“Reloading endpoints”
time=“Oct 11 16:54:52” level=info msg=“Reload queued”
time=“Oct 11 16:54:52” level=info msg=“Initiating reload”
time=“Oct 11 16:54:52” level=info msg=“Loading policies”
time=“Oct 11 16:54:52” level=info msg=“Using Policies from Dashboard Service”
time=“Oct 11 16:54:52” level=info msg=“Mutex lock acquired… calling”
time=“Oct 11 16:54:52” level=info msg=“Calling dashboard service for policy list”
time=“Oct 11 16:54:52” level=info msg=“Processing policy list”
time=“Oct 11 16:54:52” level=info msg=“Detected 4 APIs”
time=“Oct 11 16:54:52” level=info msg=“Preparing new router”
time=“Oct 11 16:54:52” level=info msg=“Initialising Tyk REST API Endpoints”
time=“Oct 11 16:54:52” level=info msg=“Loading API configurations.”
time=“Oct 11 16:54:52” level=info msg=“Tracking hostname” api_name=“Portal Assets” domain=www.tyk-portal-test.com
time=“Oct 11 16:54:52” level=info msg=“Tracking hostname” api_name=“Portal API” domain=www.tyk-portal-test.com
time=“Oct 11 16:54:52” level=info msg=“Tracking hostname” api_name=“Test API” domain=“(no host)”
time=“Oct 11 16:54:52” level=info msg=“Tracking hostname” api_name=Portal domain=www.tyk-portal-test.com
time=“Oct 11 16:54:52” level=info msg=“Loading API” api_name=“Test API”
time=“Oct 11 16:54:52” level=info msg=“Loading API” api_name=“Portal API”
time=“Oct 11 16:54:52” level=info msg=“Checking security policy: Open” api_name=“Portal API”
time=“Oct 11 16:54:52” level=info msg=“----> Fetching Bundle: python-bundle.zip”
time=“Oct 11 16:54:52” level=info msg=“Loading API” api_name=“Portal Assets”
time=“Oct 11 16:54:52” level=info msg=“Loading API” api_name=Portal
time=“Oct 11 16:54:52” level=info msg=“Checking security policy: Open” api_name=“Portal Assets”
time=“Oct 11 16:54:52” level=info msg=“Checking security policy: Open” api_name=Portal
time=“Oct 11 16:54:52” level=info msg=“----> Loading bundle: python-bundle.zip”
time=“Oct 11 16:54:52” level=info msg=“----> Verifying bundle: python-bundle.zip”
time=“Oct 11 16:54:52” level=info msg=“----> Bundle is valid, adding to spec: python-bundle.zip”
time=“Oct 11 16:54:52” level=info msg=“Checking security policy: CoProcess Plugin” api_name=“Test API”
time=“Oct 11 16:54:52” level=info msg=“Loading module: ‘middleware’”
time=“Oct 11 16:54:53” level=info msg=“Processed and listening on: /portal-assets/{rest:.}"
time=“Oct 11 16:54:53” level=info msg="Processed and listening on: /portal-api/{rest:.
}”
time=“Oct 11 16:54:53” level=info msg=“Processed and listening on: /test-api/{rest:.}"
time=“Oct 11 16:54:53” level=info msg="Processed and listening on: /portal/{rest:.
}”
time=“Oct 11 16:54:53” level=info msg=“Loading uptime tests…”
time=“Oct 11 16:54:53” level=info msg=“Initialised API Definitions”
time=“Oct 11 16:54:53” level=info msg=“API reload complete”
time=“Oct 11 16:54:53” level=info msg=“Initiating coprocess reload”
time=“Oct 11 16:54:53” level=info msg=“Reloading middlewares”
time=“Oct 11 16:54:53” level=info msg=“Reloading event handlers and middlewares.”
time=“Oct 11 16:54:53” level=warning msg=“Purging middleware: ‘middleware’”
time=“Oct 11 16:55:28” level=error msg=“Can’t dispatch ‘MyAuthMiddleware’, hook is not defined.”
time=“Oct 11 16:55:28” level=error msg=“request error: Key not authorised” api_id=ce5360c963ac475277a1672ec858635a org_id=59de481c2e7f09000106f0b6 path=“/get” server_name=“http://httpbin.org/” user_id= user_ip=172.18.0.1