connect-mongodb-session
connect-mongodb-session copied to clipboard
Error setting new cookie
Hello Im having this error, any info about this?
Error: Error setting nOomfHkFjg9PUyGVQK77Q4q1yWqSfCfy to Session {
cookie:
{ path: '/',
_expires: 2020-02-12T14:58:30.224Z,
originalMaxAge: 604800000,
httpOnly: true } }: failed to reconnect after 30 attempts with interval 1000 ms
at /usr/src/app/node_modules/connect-mongodb-session/index.js:226:21
at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:74:5)
at updateCallback (/usr/src/app/node_modules/mongodb/lib/operations/update_one.js:30:19)
at updateDocuments (/usr/src/app/node_modules/mongodb/lib/operations/update_one.js:24:64)
at handleCallback (/usr/src/app/node_modules/mongodb/lib/utils.js:128:55)
at Object.coll.s.topology.update [as c] (/usr/src/app/node_modules/mongodb/lib/operations/common_functions.js:372:21)
at Store.flush (/usr/src/app/node_modules/mongodb/lib/topologies/topology_base.js:114:8)
at Server.reconnectFailedHandler (/usr/src/app/node_modules/mongodb/lib/topologies/server.js:257:20)
at Server.emit (events.js:198:13)
at Server.EventEmitter.emit (domain.js:448:20)
at Pool.<anonymous> (/usr/src/app/node_modules/mongodb/lib/core/topologies/server.js:420:14)
at Pool.emit (events.js:198:13)
at Pool.EventEmitter.emit (domain.js:448:20)
at Timeout.<anonymous> (/usr/src/app/node_modules/mongodb/lib/core/connection/pool.js:325:12)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
Error: Error setting CSbxehlptV97mUcXk_2OEk0wY-eW0T5X to Session {
cookie:
{ path: '/',
_expires: 2020-02-12T14:58:30.567Z,
originalMaxAge: 604800000,
httpOnly: true } }: failed to reconnect after 30 attempts with interval 1000 ms
at /usr/src/app/node_modules/connect-mongodb-session/index.js:226:21
at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:74:5)
at updateCallback (/usr/src/app/node_modules/mongodb/lib/operations/update_one.js:30:19)
at updateDocuments (/usr/src/app/node_modules/mongodb/lib/operations/update_one.js:24:64)
at handleCallback (/usr/src/app/node_modules/mongodb/lib/utils.js:128:55)
at Object.coll.s.topology.update [as c] (/usr/src/app/node_modules/mongodb/lib/operations/common_functions.js:372:21)
at Store.flush (/usr/src/app/node_modules/mongodb/lib/topologies/topology_base.js:114:8)
at Server.reconnectFailedHandler (/usr/src/app/node_modules/mongodb/lib/topologies/server.js:257:20)
at Server.emit (events.js:198:13)
at Server.EventEmitter.emit (domain.js:448:20)
at Pool.<anonymous> (/usr/src/app/node_modules/mongodb/lib/core/topologies/server.js:420:14)
at Pool.emit (events.js:198:13)
at Pool.EventEmitter.emit (domain.js:448:20)
at Timeout.<anonymous> (/usr/src/app/node_modules/mongodb/lib/core/connection/pool.js:325:12)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/usr/src/app/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/usr/src/app/node_modules/express/lib/response.js:267:15)
at /usr/src/app/bin/app.js:94:9
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at Immediate.next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at runCallback (timers.js:706:11)
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/usr/src/app/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/usr/src/app/node_modules/express/lib/response.js:267:15)
at /usr/src/app/bin/app.js:94:9
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at Immediate.next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at runCallback (timers.js:706:11)
Error: Error finding 9EM7Iu13rhk2cEy4wWBI6azNaD2Nzj7c: pool destroyed
at /usr/src/app/node_modules/connect-mongodb-session/index.js:120:21
at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:74:5)
at handleCallback (/usr/src/app/node_modules/mongodb/lib/utils.js:128:55)
at cursor.next (/usr/src/app/node_modules/mongodb/lib/operations/find_one.js:28:33)
at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:74:5)
at handleCallback (/usr/src/app/node_modules/mongodb/lib/utils.js:128:55)
at cursor._next (/usr/src/app/node_modules/mongodb/lib/operations/common_functions.js:236:21)
at self._initializeCursor (/usr/src/app/node_modules/mongodb/lib/core/cursor.js:750:9)
at done (/usr/src/app/node_modules/mongodb/lib/core/cursor.js:463:7)
at executeOperation (/usr/src/app/node_modules/mongodb/lib/core/cursor.js:547:11)
at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:74:5)
at callbackWithRetry (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:126:14)
at Pool.write (/usr/src/app/node_modules/mongodb/lib/core/connection/pool.js:840:5)
at _command (/usr/src/app/node_modules/mongodb/lib/core/wireprotocol/command.js:128:10)
at command (/usr/src/app/node_modules/mongodb/lib/core/wireprotocol/command.js:28:5)
at Object.query (/usr/src/app/node_modules/mongodb/lib/core/wireprotocol/query.js:57:3)
all next logs are same pool destroyed
failed to reconnect after 30 attempts with interval 1000 ms
This is because the connection between MongoDB and your app has been lost. Perhaps the server went down or something went wrong in the network.
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
This is a separate issue. You probably have a middleware running before request.session()
which uses .send() or similar which caused the response to already be sent. Basically, it is erroring because you are trying to modify a response which the browser already received.