Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Error: req.flash() requires sessions #129

Open
hubitor opened this issue Dec 1, 2018 · 2 comments
Open

Error: req.flash() requires sessions #129

hubitor opened this issue Dec 1, 2018 · 2 comments

Comments

@hubitor
Copy link

hubitor commented Dec 1, 2018

I'm getting following error when I run:
$ npm start

{"message":"Default posts created!","level":"info"}
{"message":"MongoError: Topology was destroyed\n    at initializeCursor (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:766:25)\n    at nextFunction (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:591:12)\n    at Cursor.next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:833:3)\n    at Cursor._next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/cursor.js:211:36)\n   at nextObject (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/cursor_ops.js:179:10)\n    at next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/cursor_ops.js:158:3)\n    at executeOperation (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:420:24)\n    atCursor.next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/cursor.js:253:10)\n    at findOne (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:567:10)\n    at /home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:437:24\n    at new Promise (<anonymous>)\nat executeOperation (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:432:10)\n    at Collection.<anonymous> (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/collection.js:1028:12)\n    at Collection.deprecated [as findOne] (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:652:17)\n    at withCallback.collectionReady.then.collection (/home/user/workspace/ExpressJS/test_project_10/node_modules/connect-mongo/src/index.js:192:46)\n    at process._tickCallback (internal/process/next_tick.js:68:7)","level":"error"}
Error: req.flash() requires sessions
    at IncomingMessage._flash [as flash] (/home/user/workspace/ExpressJS/test_project_10/node_modules/connect-flash/lib/flash.js:60:41)
    at ServerResponse.res.render (/home/user/workspace/ExpressJS/test_project_10/node_modules/express-flash/lib/express-flash.js:28:35)
    at /home/user/workspace/ExpressJS/test_project_10/server/routes/errors.js:20:15
    at Layer.handle_error (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:315:13)
    at /home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:335:12)
    at next (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:315:13)
    at /home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:335:12)
    at next (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:315:13)
    at /home/user/workspace/ExpressJS/test_project_10/node_modules/express/lib/router/index.js:284:7
{"message":"\u001b[0mGET / \u001b[31m500 \u001b[0m4.233 ms - -\u001b[0m\n","level":"debug"}
{"message":"MongoError: Topology was destroyed\n    at initializeCursor (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:766:25)\n    at nextFunction (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:591:12)\n    at Cursor.next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:833:3)\n    at Cursor._next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/cursor.js:211:36)\n   at nextObject (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/cursor_ops.js:179:10)\n    at next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/cursor_ops.js:158:3)\n    at executeOperation (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:420:24)\n    atCursor.next (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/cursor.js:253:10)\n    at findOne (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:567:10)\n    at /home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:437:24\n    at new Promise (<anonymous>)\nat executeOperation (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:432:10)\n    at Collection.<anonymous> (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/collection.js:1028:12)\n    at Collection.deprecated [as findOne] (/home/user/workspace/ExpressJS/test_project_10/node_modules/mongoose/node_modules/mongodb/lib/utils.js:652:17)\n    at withCallback.collectionReady.then.collection (/home/user/workspace/ExpressJS/test_project_10/node_modules/connect-mongo/src/index.js:192:46)\n    at process._tickCallback (internal/process/next_tick.js:68:7)","level":"error"}
@trebleCode
Copy link

@hubitor we abandoned using this boilerplate for a project and went with what it's based on:

https://github.com/sahat/hackathon-starter

and have had alot of success since. You could always tack Vue on top of it afterwards

@hubitor
Copy link
Author

hubitor commented Dec 14, 2018

@trebleCode : thanks for the tip!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants