CP Driver not supported


#1

Hello,

I’ve got tyk gateway + dashboard installed on red hat.

Installation was done using: https://tyk.io/tyk-documentation/get-started/with-tyk-on-premise/installation/redhat-rhel-centos/

Then based on the documentation I tried to create some ‘hello world’ plugin using python.

I’ve got the following setting in the tyk.conf

“coprocess_options”: {
“enable_coprocess”: true
},

“enable_bundle_downloader”: true,
“bundle_base_url”: “http://<server_IP>:8080/test/”,

additionally in the api configuration I’ve got:

“custom_middleware_bundle”:“bundle.zip” which is created using tyk-cli.

Inside the bundle I’ve got the followiing

manifest.json
{
“file_list”: [
“mymiddleware.py”
],
“custom_middleware”: {
“pre”: [
{
“name”: “MyPreMiddleware”
}
],
“post”: [
],
“driver”: “python”
},
“checksum”: “”,
“signature”: “”
}

and

mymiddleware.py:
from tyk.decorators import *
from gateway import TykGateway as tyk

@Hook
def MyPreMiddleware(request, session, spec):
request.add_header(‘myheader’, ‘myvalue’)
return request, session

After restarting/reloading tyk-gateway with these setting I got the following error:

time=“Feb 17 11:14:29” level=error msg=“Couldn’t create bundle directory: mkdir middleware/bundles/b333cfebefbe4107578952cae4b72f78-bundle.zip: no such file or directory” api_id=b333cfebefbe4107578952cae4b72f78 org_id= path=- server_name=“http://<IP/blablabla>” user_id=- user_ip=-

I’ve found the solution: The problem was that in /opt/tyk-gateway/middleware there was no bundles directory

WHY?

Anyway, after the directory was created, the tyk downloaded the bundle and stored it in the right path.

BUT

Now I’m getting the following for both python/lua cases:

time=“Feb 17 14:29:22” level=error msg=“CP Driver not supported: python”
time=“Feb 17 14:52:09” level=error msg=“CP Driver not supported: lua”

WHY?

Did I miss some configuration steps?

Regards.


#2

Hi, how do you start/stop Tyk?

In this case you need to use:

service tyk-gateway stop
service tyk-gateway-python start

The tyk-gateway-python service uses the alternative binary (CP build).


#3

Thank you for your answer.

Your solution helped in getting rid of “driver not supported” error, but not I’m getting panic while sending the requests for both cases python and lua plugins.

  1. lua, started tyk-gateway-lua + api configuration has lua bundle:

2017/02/21 13:53:37 http: panic serving 10.197.30.5:33914: runtime error: invalid memory address or nil pointer dereference
goroutine 8049 [running]:
net/http.(*conn).serve.func1(0xc420e61880)
/usr/local/go/src/net/http/server.go:1491 +0x12a
panic(0xcba200, 0xc420010050)
/usr/local/go/src/runtime/panic.go:458 +0x243
main.(*CoProcessor).ObjectPostProcess(0xc42052d5d0, 0xc420ed5600, 0xc420f205a0)
/src/github.com/TykTechnologies/tyk/coprocess.go:130 +0x3e
main.(*CoProcessMiddleware).ProcessRequest(0xc420eaeff0, 0x14bfca0, 0xc42005f110, 0xc420f205a0, 0xcdad00, 0x0, 0x1c, 0xc420035a88, 0x52326e)
/src/github.com/TykTechnologies/tyk/coprocess.go:272 +0x4dc
main.CreateMiddleware.func1.1(0x14bfca0, 0xc42005f110, 0xc420f205a0)
/src/github.com/TykTechnologies/tyk/middleware.go:76 +0x637
net/http.HandlerFunc.ServeHTTP(0xc420ed8940, 0x14bfca0, 0xc42005f110, 0xc420f205a0)
/usr/local/go/src/net/http/server.go:1726 +0x44
github.com/TykTechnologies/tyk/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4203b1220, 0x14bfca0, 0xc42005f110, 0xc420f205a0)
/src/github.com/TykTechnologies/tyk/vendor/github.com/gorilla/mux/mux.go:114 +0x10d
net/http.(*ServeMux).ServeHTTP(0x1564700, 0x14bfca0, 0xc42005f110, 0xc420f203c0)
/usr/local/go/src/net/http/server.go:2022 +0x7f
net/http.serverHandler.ServeHTTP(0xc420ece100, 0x14bfca0, 0xc42005f110, 0xc420f203c0)
/usr/local/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc420e61880, 0x14c0ce0, 0xc420ed5400)
/usr/local/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2293 +0x44d

  1. python, started tyk-gateway-python + api configuration has python bundle:

2017/02/21 13:59:19 http: panic serving 10.197.30.5:33916: runtime error: invalid memory address or nil pointer dereference
goroutine 1016 [running]:
net/http.(*conn).serve.func1(0xc42072fb80)
/usr/local/go/src/net/http/server.go:1491 +0x12a
panic(0xcc2520, 0xc420010050)
/usr/local/go/src/runtime/panic.go:458 +0x243
main.(*CoProcessor).Dispatch(0xc4208bf5c0, 0xc4204bcf00, 0xc4204bcf00, 0x2, 0xc420907ffc)
/src/github.com/TykTechnologies/tyk/coprocess_native.go:54 +0xdb
main.(*CoProcessMiddleware).ProcessRequest(0xc4208099e0, 0x14c9ce0, 0xc42006da00, 0xc4200cf3b0, 0xce3020, 0x0, 0x1c, 0xc42059aa88, 0x52494e)
/src/github.com/TykTechnologies/tyk/coprocess.go:262 +0x374
main.CreateMiddleware.func1.1(0x14c9ce0, 0xc42006da00, 0xc4200cf3b0)
/src/github.com/TykTechnologies/tyk/middleware.go:76 +0x637
net/http.HandlerFunc.ServeHTTP(0xc4203f6100, 0x14c9ce0, 0xc42006da00, 0xc4200cf3b0)
/usr/local/go/src/net/http/server.go:1726 +0x44
github.com/TykTechnologies/tyk/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4203fa000, 0x14c9ce0, 0xc42006da00, 0xc4200cf3b0)
/src/github.com/TykTechnologies/tyk/vendor/github.com/gorilla/mux/mux.go:114 +0x10d
net/http.(*ServeMux).ServeHTTP(0x156e720, 0x14c9ce0, 0xc42006da00, 0xc4200cf1d0)
/usr/local/go/src/net/http/server.go:2022 +0x7f
net/http.serverHandler.ServeHTTP(0xc42075a900, 0x14c9ce0, 0xc42006da00, 0xc4200cf1d0)
/usr/local/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc42072fb80, 0x14cad20, 0xc4204bcd00)
/usr/local/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2293 +0x44d