TypeError: Cannot read property 'expires' of undefined when using the crypto option
See original GitHub issueThis error only appears when crypto.secret is set.
I have done some debugging and the issue seems to be that the session object is over stringified while the crypto option is used. Therefore, the session json is not converted to an object while the createSession function treats the session parameter as an object.
At MongoStore.js line 197, the session is still a json string when it is passed to callback.:
const s = session && this.transformFunctions.unserialize(session.session);
if (this.options.touchAfter > 0 && (session === null || session === void 0 ? void 0 : session.lastModified)) {
s.lastModified = session.lastModified;
}
this.emit('get', sid);
callback(null, s);
Trace:
TypeError: Cannot read property 'expires' of undefined
at MongoStore.Store.createSession (...\node_modules\express-session\session\store.js:87:29)
at inflate (...\node_modules\express-session\index.js:368:13)
at ...\node_modules\express-session\index.js:495:11
at ...\node_modules\connect-mongo\build\main\lib\MongoStore.js:202:17
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Express.io "Cannot read property of 'expires' of undefined"
This is my first time working with node.js and I am trying to use express.io to save cookies. I have literally carbon copied...
Read more >Existing encrypted v3.2.0 sessions are not decrypted correctly ...
Behaviour in 3.2.0 is not expected as stated in TypeError: Cannot read property 'expires' of undefined when using the crypto option #393 so ......
Read more >San Diego Patch 7 - Product Documentation | ServiceNow
Reconciliation for Oracle publisher failed due to the following error: 'TypeError: Cannot read property 'max_size_on_cloud' from undefined' ...
Read more >cannot read properties of undefined (reading 'auth') firebase
onAuthStateChanged ( (user)" 2 i am new to using react native and firebase, I have this error: "TypeError: Cannot read property 'auth' of...
Read more >Cannot read property 'remove' of undefined in customer-data.js
Here's how to easily fix it in Magento 2.4.3-p1. Uncaught TypeError: Cannot read property 'remove' of undefined at customer-data.js:178 at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
fixed in 4.2.2
As an FYI, a new release for kruptein should address this with
v3.0.0
. I have been testing with the example project and should have a PR soon