question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Koa multer can not work with koa-router

See original GitHub issue

Hi, this multer can not work with alexmingoia/koa-router (My koa is 1.x) My code is:

const uploader = require('koa-multer')({dest: path.join(__dirname, '../upload')}); const router = new (loadLib('koa-router'))(); router.post('/lo/banner/img', uploader.single('image'), function *() {...}) When upload a file, it will throw an Error below:

TypeError: next[(intermediate value)] is not a function at Object.allowedMethods (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:374:12) at next (native) at Object.allowedMethods (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:374:12) at next (native) at Object.dispatch (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:336:14) at next (native) at Object.serve (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-static/index.js:43:14) at next (native) at Object.serve (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-static/index.js:43:14) at next (native) at onFulfilled (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:65:19) at /home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:54:5 at Object.co (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:50:10) at Object.toPromise (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:118:63) at next (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:99:29) at onFulfilled (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:69:7)

So I make some changes with koa-multer and make it work with koa-router successful.The code I changed is: iooly/iooly-koa-multer.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
pleerockcommented, Jul 13, 2016

koa-router is the most popular router. This middleware must be able to support it

0reactions
jiananshicommented, May 17, 2017

How’s this issues going? koa-router is still not supported yet? It would be better to put a notice on README file if it’s still unavailable

Read more comments on GitHub >

github_iconTop Results From Across the Web

koa-router-multer - npm Package Health Analysis | Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
How to upload file using Koa? - node.js - Stack Overflow
The first is by adding callback function to the end of the route. const multer = require('@koa/multer') //Options to limit file size and...
Read more >
koa-router middleware not working on route level - Reddit
When there are no more middleware functions, Koa works its way back down the stack. Koa pops the topmost middleware off the stack...
Read more >
koa-router-multer - npm
Wrapper of koa-multer, for koa-router. Tested with Koa 2.x, should work with Koa 1.x as well. Dependency Status devDependency Status license ...
Read more >
koa-router-multer - NPM Package Overview - Socket - Socket.dev
Tested with Koa 2.x, should work with Koa 1.x as well. Dependency Status · devDependency Status · license. Install. $ npm install --save...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found