dvonlehman / express-request-proxy

Advanced streaming http request proxy middleware for Express with support for custom routes, caching, and response transforms.
96 stars 38 forks source link

Error: Expected "0" to be defined #14

Open zoell opened 8 years ago

zoell commented 8 years ago

Hi,

I am getting an error for the following code:

var express = require('express');
var requestProxy = require('express-request-proxy');
var memoryCache = require('memory-cache-stream');
var app = express();

app.get('/data/find', requestProxy({
    cache: memoryCache(),
    cacheMaxAge: 10,
    url: "http://dataservice:5001/getdata/find?query=*"
}));

app.listen(5000, function () {
    console.log('Listening: 5000');
});

And the error is:

Error: Expected "0" to be defined
   at Function.Error.create (/src/node_modules/express-request-proxy/node_modules/simple-errors/index.js:25:11)
   at Function.Error.http (/src/node_modules/express-request-proxy/node_modules/simple-errors/index.js:68:21)
   at proxyViaCache (/src/node_modules/express-request-proxy/lib/proxy.js:119:25)
   at /src/node_modules/express-request-proxy/lib/proxy.js:58:14
   at Layer.handle [as handle_request] (/src/node_modules/express/lib/router/layer.js:95:5)
   at next (/src/node_modules/express/lib/router/route.js:131:13)
   at Route.dispatch (/src/node_modules/express/lib/router/route.js:112:3)
   at Layer.handle [as handle_request] (/src/node_modules/express/lib/router/layer.js:95:5)
   at /src/node_modules/express/lib/router/index.js:277:22
   at Function.process_params (/src/node_modules/express/lib/router/index.js:330:12)

Deps from my package.json

  "dependencies": {
    "winston": "^2.2.0",
    "express-request-proxy": "^2.0.0",
    "express": "^4.13.4",
    "memory-cache-stream": "^1.0.4"
  },

Any idea what I am missing?