requarks / express-brute-loki

A Loki.js store for Express-Brute
MIT License
12 stars 4 forks source link

value.lastRequest.getTime is not a function #5

Open sudosammy opened 6 years ago

sudosammy commented 6 years ago

Unsure what's causing this, but occurs when handling requests with this module. Confirmed the expected behaviour when using express-brute with MemoryStore().

TypeError: value.lastRequest.getTime is not a function
    at .<anonymous> (/home/xxx/node_modules/express-brute/index.js:100:47)
    at LokiStore.get (/home/xxx/node_modules/express-brute-loki/lib/express-brute-loki.js:111:3)
    at .<anonymous> (/home/xxx/node_modules/express-brute/index.js:82:15)
    at keyFunc (/home/xxx/node_modules/express-brute/index.js:39:41)
    at .<anonymous> (/home/xxx/node_modules/express-brute/index.js:47:3)
    at Layer.handle [as handle_request] (/home/xxx/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/xxx/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/xxx/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/xxx/node_modules/express/lib/router/layer.js:95:5)
    at /home/xxx/node_modules/express/lib/router/index.js:281:22

Code:

var store = new ExpressBruteLokiStore({
  path: './brute.db'
});
//var store = new ExpressBrute.MemoryStore(); // stores state locally, don't use this in production 
var bruteforce = new ExpressBrute(store);

app.post('/auth',
    bruteforce.prevent, // error 429 if we hit this route too often 
    function (req, res, next) {
        res.send('Success!');
    }
);
cmsiesde commented 5 years ago

I have the same issue