"Session Store" option memory, remove additional data during login


If I add aditional data into a the session in a route file like:

req.session.myTestSession = 'abcdef1234';
console.log('session:',  req.session);

In console I can see

session: Session {
  cookie: { path: '/', _expires: null, originalMaxAge: null, httpOnly: true },
  myTestSession : 'abcdef1234'

But then when trying to login, btw I have a custom extension for another purposes and I am able to set console.log during the login to get the same session and I get this new output:

session: Session {
  cookie: { path: '/', _expires: null, originalMaxAge: null, httpOnly: true },

The custom session was remove.
If I change "Session Store" to redis or database its works normally (I haven't testing file option).

Additional, using memory option I get this in console:

(node:31092) TimeoutOverflowWarning: 86400000000 does not fit into a 32-bit signed integer.
Timeout duration was set to 1.
(Use `node --trace-warnings ...` to show where the warning was created)

For the overflow warning it seems that it multiplied the number 2 times with 1000. That is a factor 1000 to many, the timeout in the memory store is in milliseconds and in our settings you set it in seconds, so it is multiplied by 1000.

We recently updated the login that it regenerates the session, a new session is generated and old data from previous session is copied. Due to the error this probably failed. Will check if the regenerate session perhaps causes the duplicate multiplication.

Seems that the default config options for ttl was still in milliseconds. Updated it to seconds in the following update, that should fix the overflow error and I hope also the other problem.

config.zip (1.2 KB) unzip in lib/setup.

1 Like

Its works thanks.
Using "Session Store" to memory option my custom session variables now remains during login and this log disappear.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Fixed in Wappler 6.6.0