Hi,
I am trying to load a plugin written in python (using in “post”). I already have a JS custom middleware (used as “pre”).
I see that when I load my Python middleware bundle, then the JS one does not load. Can someone please confirm if two custom middlewares can be used simultaneously?
Thank you,
AJ
1 Like
Hi, can you confirm if you’re using both settings in the same API definition?
I think so. I see these
"custom_middleware": {
"pre": [
{
"name": "authMiddleware",
"path": "/opt/tyk-gateway/middleware/authMiddleware.js",
"require_session": false
}
],
"post": [],
"post_key_auth": [],
"auth_check": {
"name": "",
"path": "",
"require_session": false
},
"response": [],
"driver": "",
"id_extractor": {
"extract_from": "",
"extract_with": "",
"extractor_config": {}
}
},
"custom_middleware_bundle": "oidc-distributed-claims-conduit.zip",
and oidc-distributed-claims-conduit.zip
manifest is
{
"file_list": [
"middleware.py"
],
"custom_middleware": {
"driver": "python",
"post": [
{
"name": "OpenIDConnectDistributedClaimsConduit",
"require_session": true
}
]
},
"checksum": "",
"signature": ""
}
1 Like
We don’t support using two plugin drivers in the same API.
The bundler works in a way that it replaces the custom_middleware
block with the contents of your bundle’s manifest file, this is the reason why JS stops working.
Possible solutions:
a) Port all the functionality to JS.
b) Port all the functionality to Python.
c) Create two APIs and use a language for each one, merge them under a third API.
Regards.
1 Like
Thank you! I naively thought that the plugin bundles would be akin to Django’s middleware, where each layer is run but in a precedence. This makes a lot of sense now that I am seeing the middleware not being loaded.