Getting bundle downloader to work issues

In my gateway’s (2.3.7) tyk.conf the following is setup

"enable_bundle_downloader": true,
"bundle_base_url": "http://192.168.0.216:8888/tyk/",

My API def has the following:

"custom_middleware_bundle": "my-bundle.zip",

I can download manually in a browser: http://192.168.0.216:8888/tyk/my-bundle.zip (its unsigned)

I restarted the gateway, see nothing about downloading the bundle.

I hit the API endpoint and just get a failure as the API is dependent on an custom Auth Plugin auth header that the middleware should be setting, but it is not, because I don’t see any evidence that its being pulled, installed and used by the API.

This middleware works fine, when not in a bundle, and just referenced locally on the gateway via the normal custom_middleware block

Ok setting the “enable_coprocess: true” seems to activate it, but now I get

Couldn't create bundle directory: mkdir middleware/bundles/ba2c643525a54dc34b975179a7d9f12a-my-bundle.zip: no such file or directory" api_id=ba2c643525a54dc34b975179a7d9f12a org_id=5976507eb46f2e00016bb4a1 path=- server_name="http://192.168.0.216:9080/mytestapi" user_id=- user_ip=-

Also this is now in the logs (I don’t need GRPC, just the ability to download a bundle containing JSVM js components)

2017-08-07T14:52:41.958472073Z time="Aug  7 14:52:41" level=error msg="No gRPC URL is set!"
2017-08-07T14:52:41.958535897Z 2017/08/07 14:52:41 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: No gRPC URL is set!"; Reconnecting to { <nil>}

I then logged into the container (gateway) and manually created the middleware/bundle directory (why do I have to do this?)

Restarted gateway and now the previous error above is gone, but now these new ones. (note the container runs as root so no idea why it could not or did not create that bundle directory on its own)

2017-08-07T14:58:32.776748541Z time=“Aug 7 14:58:32” level=info msg=“----> Loading bundle: my-bundle.zip”
2017-08-07T14:58:32.776788593Z time=“Aug 7 14:58:32” level=info msg=“----> Verifying bundle: my-bundle.zip”
2017-08-07T14:58:32.777200804Z time=“Aug 7 14:58:32” level=info msg=“----> Bundle is valid, adding to spec: my-bundle.zip”
2017-08-07T14:58:32.777237061Z time=“Aug 7 14:58:32” level=error msg=“Failed to load Middleware JS: read middleware/bundles/ba2c643525a54dc34b975179a7d9f12a-my-bundle.zip: is a directory”
2017-08-07T14:58:32.777260533Z time=“Aug 7 14:58:32” level=error msg=“Failed to load Middleware JS: read middleware/bundles/ba2c643525a54dc34b975179a7d9f12a-my-bundle.zip: is a directory”

If I shell into the gateway I do see this directory

/opt/tyk-gateway/middleware/bundles/ba2c643525a54dc34b975179a7d9f12a-my-bundle.zip

Inside of it are the contents of my bundle, but I don’t understand the error above

Is this a bug? appears that this is invoked but it wants files, not directories.

added issue: middleware bundle downloader fails w/ "otto" driver · Issue #992 · TykTechnologies/tyk · GitHub

Hi, can you share your bundle manifest?

{
      "file_list": [
        "myMiddleware1.js",
        "myMiddleware2.js"
      ],
      "custom_middleware": {
        "pre": [
          {"name": "myMiddleware1"},
          {"name": "myMiddleware2"}
        ],
        "post": [],
        "driver": "otto"
      },
      "checksum": "",
      "signature": ""
}