express: TypeError: req.next is not a function
The server stops right away throwing this error. The layout of my template also breaks with no CSS. Please note that I’m not using any middleware, nor am I using next in my callback. I have been looking for a solution but found no concrete solution so far.
/workspace/course/ip/node_modules/express/lib/response.js:1007
if (err) return req.next(err);
^
TypeError: req.next is not a function
at done (/workspace/course/ip/node_modules/express/lib/response.js:1007:25)
at tryRender (/workspace/course/ip/node_modules/express/lib/application.js:642:5)
at Function.render (/workspace/course/ip/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/workspace/course/ip/node_modules/express/lib/response.js:1012:7)
at /workspace/course/ip/routes/index.js:341:13
at Array.forEach (<anonymous>)
at QueryReqWrap.callback (/workspace/course/ip/routes/index.js:340:13)
at QueryReqWrap.onresolve [as oncomplete] (dns.js:198:10)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (5 by maintainers)
Ah. It is likely you are calling
res.render
multiple times in the same request. We can fix it so the error won’t be thrown, but ultimately your code is not going to do what you’re trying to do – you can only callres.render
once, when you’re ready to render the response.@azakero can you share a minimal app which reproduces this error?