Can't call method 'call' of undefined
Thomasdezeeuw opened this issue · comments
When I first request the page I get the correct response, however the second request I get a 500 response.
app.use(function* (next) {
// Array with middleware functions,
// generated elsewhere, but on every request
var mws = [];
yield compose(mws);
yield next;
});
Error stack:
TypeError: Cannot call method 'call' of undefined
at Object. (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa-compose/index.js:36:19)
at GeneratorFunctionPrototype.next (native)
at next (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa/node_modules/co/index.js:76:21)
at Object. (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa/node_modules/co/index.js:56:5)
at next (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa/node_modules/co/index.js:92:21)
at Object. (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa/node_modules/co/index.js:56:5)
at Server. (/Users/thomas/CloudStation/Dropbox/www/koa-router/node_modules/koa/lib/application.js:105:8)
at Server.EventEmitter.emit (events.js:101:17)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
For some reason it works again, but I'm sure what I have changed.