Environment
const onerror = err => ctx.onerror(err);
^
TypeError: ctx.onerror is not a function
at Array.onerror (./server/node_modules/koa/lib/application.js:147:32)
at listener (./server/node_modules/on-finished/index.js:169:15)
at onFinish (./server/node_modules/on-finished/index.js:100:5)
at callback (./dist/server/node_modules/ee-first/index.js:55:10)
at ServerResponse.onevent (./server/node_modules/ee-first/index.js:93:5)
at emitNone (events.js:111:20)
at ServerResponse.emit (events.js:208:7)
at onFinish (_http_outgoing.js:720:10)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
How to fix it?
const onerror = err => ctx.onerror(err);const onerror = ctx.onerror;paragraph removed by fl0w
Could you provide a full minimal reproducible example showcasing how this occurs?
Having the same issue.
I found out what my problem was.
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const app = new Koa();
// I forgot to call the bodyParser module...
// app.use(bodyParser);
// better :)
app.use(bodyParser());
@und3fined perhaps this or something like this was your issue?
This is bug with bodyParser(koa-bodyparser) =))
I get the same error and fixed it with app.use(bodyParser())
I get the same error too and fixed it with app.use(bodyParser())
Most helpful comment
I found out what my problem was.
@und3fined perhaps this or something like this was your issue?