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.

Koa2 support - next is not a function?

See original GitHub issue

Hi guys,

I’m trying to tweak this example to work with Koa2

https://github.com/kristianmandrup/vue-hackernews-2.0

However I get a strange error:

According to the call stack, koa-compose ends up calling webpack-dev-middleware which expects a next argument.

Maybe related to this issue ?? or this?

  TypeError: next is not a function
      at goNext (/Users/kristianmandrup/repos/aurelia-projs/ai/vue-hackernews-2.0/node_modules/webpack-dev-middleware/middleware.js:194:41)
      at webpackDevMiddleware (/Users/kristianmandrup/repos/aurelia-projs/ai/vue-hackernews-2.0/node_modules/webpack-dev-middleware/middleware.js:206:33)
      at dispatch (/Users/kristianmandrup/repos/aurelia-projs/ai/vue-hackernews-2.0/node_modules/koa-compose/index.js:43:32)
      at /Users/kristianmandrup/repos/aurelia-projs/ai/vue-hackernews-2.0/node_modules/koa-compose/index.js:36:12
      at Server.<anonymous> (/Users/kristianmandrup/repos/aurelia-projs/ai/vue-hackernews-2.0/node_modules/koa/lib/application.js:136:7)
      at emitTwo (events.js:106:13)
      at Server.emit (events.js:191:7)
      at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)
      at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

10reactions
ydfzgyjcommented, Nov 7, 2016

you can use koa-webpack-dev-middleware and koa-webpack-hot-middleware, and wrap them by convert if you use koa2

0reactions
Paula2001commented, Mar 19, 2022

you can use koa-webpack-dev-middleware and koa-webpack-hot-middleware, and wrap them by convert if you use koa2

doesn’t support webpack 5 unfortunately and this answer is very old but good suggestion at it’s time tho

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next is not a function when trying to call an API endpoint
js with Koa and i'm getting an error TypeError: next is not a function I'm using koa and koa-mount to modularize my API....
Read more >
Koa - next generation web framework for node.js
Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust...
Read more >
koa - npm
Expressive HTTP middleware framework for node.js to make web applications and APIs more enjoyable to write. Koa's middleware stack flows in ...
Read more >
Koa2 NPM | npm.io
Koa is not bundled with any middleware. Installation. Koa requires node v4.0.0 or higher for (partial) ES2015 support. $ npm install koa@next. Hello...
Read more >
Egg@2 Upgrade guideline - Egg - Eggjs.org
DO NOT support 1.x role definition, because koa-roles is no longer compatible. ... Use Koa 2's (ctx, next) arguments style in callback function....
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