Hi,
I am using Tyk version 5.9.1 and playing around with the javascript plugin (javascript is enabled with environment variable: TYK_GW_ENABLEJSVM=true).
I have already sucessfully implemented a javascript plugin for handling the http request.
The plugin is definine in the OAS Definition like this:
"x-tyk-api-gateway": {
"info": {
"id": "my_id",
"name": "test with no auth",
"orgId": "1",
"state": {
"active": true
}
},
"middleware": {
"global": {
"pluginConfig": {
"driver": "otto"
},
"prePlugins": [
{
"enabled": true,
"functionName": "requestHeadersPlugin",
"path": "/opt/tyk-gateway/middleware/process-requests.js"
}
],
....
}
However if I want to use another script to handle the response, this do not work if I add the object responsePlugins:
According to the documentation:
My updated configuration:
"x-tyk-api-gateway": {
"info": {
"id": "my_id",
"name": "test with no auth",
"orgId": "1",
"state": {
"active": true
}
},
"middleware": {
"global": {
"pluginConfig": {
"driver": "otto"
},
"prePlugins": [
{
"enabled": true,
"functionName": "requestHeadersPlugin",
"path": "/opt/tyk-gateway/middleware/process-requests.js"
}
],
"responsePlugins": [
{
"enabled": true,
"functionName": "responseMiddleware",
"path": "/opt/tyk-gateway/middleware/process-response.js",
"requireSession": true
}
],
....
}
In the Tyk log I found the following error:
time="Feb 12 07:54:22" level=debug msg="Response hook 'CoProcessMiddleware' is called" prefix=coprocess
time="Feb 12 07:54:22" level=debug msg="Couldn't dispatch request object" error="Couldn't dispatch request, driver 'otto' isn't available"
2026/02/12 07:54:22 http: panic serving 192.168.80.5:38968: runtime error: invalid memory address or nil pointer dereference
goroutine 2714 [running]:
net/http.(*conn).serve.func1()
net/http/server.go:1947 +0xbe
panic({0xa567000?, 0x113f7d30?})
runtime/panic.go:791 +0x132
github.com/sirupsen/logrus.(*Entry).Dup(...)
github.com/sirupsen/[email protected]/entry.go:82
github.com/TykTechnologies/tyk/gateway.(*BaseMiddleware).Copy(...)
In the documentation I found many ways to configure the middleware plugins and I am not sure which one is the correct one?:
Creating an OAS APi with the Playground :
I have also tried by implementing the json produced with the playground (see screenshot above) and I got the same error:
time="Feb 12 07:54:22" level=debug msg="Response hook 'CoProcessMiddleware' is called" prefix=coprocess
time="Feb 12 07:54:22" level=debug msg="Couldn't dispatch request object" error="Couldn't dispatch request, driver 'otto' isn't available"
2026/02/12 07:54:22 http: panic serving 192.168.80.5:38968: runtime error: invalid memory address or nil pointer dereference
Thank you for your help.


