You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to use the session of a user to store variables which needs to be used in different pages. The issue with the solution, is that the session seems to have an issue always updating the session in mongoDB.
Process:
The user will access a URL, the function of the URL is to have NodeJS to update a variable stored in res.user.someValue
NodeJS will call res.redirect
The user will access the redirected URL. NodeJS is processing the request and getting res.user.someValue. This value is not identical to the one just set in step 1.
The issue was thoroughly tested using an automated test. The test ran 100 times on a Mac m1, which resulted in 30 cases where req.user.someValue was the old variable. In the same test on an older windows machine the test failed 5 times out of 100.
We are using the following for setting up our session store.
We wanted to further debug everytime the session was stored in mongo and collected from mongo, but we simply cannot start the debugging in any format for the module.
We are using the following versions: NodeJS v. 18.12.1 MongoDB v. 5.0.14 "connect-mongo": "^4.6.0", "express": "4.x", "express-session": "^1.17.3",
we'd appreciate any help we can get. Thanks
The text was updated successfully, but these errors were encountered:
Hi,
We are trying to use the session of a user to store variables which needs to be used in different pages. The issue with the solution, is that the session seems to have an issue always updating the session in mongoDB.
Process:
The issue was thoroughly tested using an automated test. The test ran 100 times on a Mac m1, which resulted in 30 cases where req.user.someValue was the old variable. In the same test on an older windows machine the test failed 5 times out of 100.
We are using the following for setting up our session store.
app.use( expressSession({ secret: process.env.COOKIE_SECRET_KEY, cookie: { sameSite: "lax", secure: process.env.SECURECOOKIE == "TRUE", domain: process.env.COOKIEDOMAIN }, proxy: true, resave: true, saveUninitialized: true, store: MongoStore.create({ mongoUrl: config.databaseUri, mongoOptions: {loggerLevel: "debug"}, autoRemove: 'interval', autoRemoveInterval: 10 // Value in minutes (default is 10) }) }) );
We wanted to further debug everytime the session was stored in mongo and collected from mongo, but we simply cannot start the debugging in any format for the module.
We are using the following versions:
NodeJS v. 18.12.1 MongoDB v. 5.0.14 "connect-mongo": "^4.6.0", "express": "4.x", "express-session": "^1.17.3",
we'd appreciate any help we can get. Thanks
The text was updated successfully, but these errors were encountered: