express session is failing because session is undefined
nikitakogan1994 opened this issue · 2 comments
Hi,
I am working with expressjs session as part of my application.
Sometimes, when a logout occurs, the code is trying to reload the session which is 'undefined' by then.
Is it possible to have a fix to check if the session is not 'undefined'? the failure is coming from the express-session code. (index.js line 387) It causes the crash of our application...
stack trace:
Exit status 1
var _reload = sess.reload
at /home/vcap/app/node_modules/express-session/index.js:387:11
^
at /home/vcap/app/node_modules/express-session/session/session.js:94:23
TypeError: Cannot read properties of undefined (reading 'reload')
at /home/vcap/app/node_modules/@sap/approuter/lib/backend-request/memstore.js:134:59
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
/home/vcap/app/node_modules/express-session/index.js:381
at wrapmethods (/home/vcap/app/node_modules/express-session/index.js:381:26)
at /home/vcap/app/node_modules/@sap/approuter/lib/backend-request/memstore.js:262:5
Node.js v18.17.1
Hey @nikitakogan1994! Thanks for reporting this error... can you provide some code about the bug so we can reproduce it?
Hi, the problem is that the issue is happening only sometimes, with no clear pattern. (besides the fact that a logout happened).
Do you have any idea on how to reproduce? or just make sure that the code will not crash?