Processor: AMD Ryzen 3 3300U with Radeon Vega Mobile Gfx 2.10 GHz Ram: 8.00 GB. OS: Windows 10 x64
What steps can reproduce the bug?
const session = require('express-session');
const express = require('express')
const MongoStore = require("connect-mongo")
const app = express()
const router = express.Router();
const port = 4431
app.set('view engine', 'ejs'); // a normal HTML file will also work instead of this middleware.
const DB = "MongoDB_URL" // I use MongoDB atlas
const sessionsecret = "SessionSecret"
const store = new MongoStore({
mongoUrl: DB,
collection: "sessions",
ttl: 1000 * 60 * 60 * 24 * 7,
})
app.use(session({
secret: sessionsecret,
resave: false,
store: store,
saveUninitialized: false,
cookie: {
sameSite: "lax",
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 7,
secure: true
},
}));
app.get("/login", async(req, res) => {
console.log(req.session.previousURL) // first time it is expected to show 'undefined', but the second time also it shows 'undefined' where it should have showed the url
req.session.previousURL = { // I explained this complex problem later.
previousURL: req.url
}
res.render("login")
})
app.listen(port, () => {
console.log("server is running on port 4431")
})
What is the expected behavior?
I expected that when using ' req.session.previousURL = { previousURL: req.url }' will create the new session object and then update it because that's how it normally happens. And I expected that doing 'console.log(req.session.previousURL)' the first time it is expected to show 'undefined', but the second time it should have shown the URL.
What do you see instead?
'express-session' or 'connect-mongo' does not work normally in Bun JS. Normally, a session object is created only once in a browser, but when using it with Bun JS using ' req.session.previousURL = { previousURL: req.url }' it creates a new session object each time instead of updating that existing session object. And when doing 'console.log(req.session.previousURL)' the first time it is expected to show 'undefined', but the second time also it shows 'undefined' where it should have showed the url.
Additional information
I am a full stack web developer, I used Node JS and Express JS, but now I use Bun JS and Express JS because of it's incredibly fast performance. I don't use Elysia JS because I know Express JS better and sometimes it is faster.
What version of Bun is running?
1.0.17+5e60861c3
What platform is your computer?
Processor: AMD Ryzen 3 3300U with Radeon Vega Mobile Gfx 2.10 GHz Ram: 8.00 GB. OS: Windows 10 x64
What steps can reproduce the bug?
What is the expected behavior?
I expected that when using ' req.session.previousURL = { previousURL: req.url }' will create the new session object and then update it because that's how it normally happens. And I expected that doing 'console.log(req.session.previousURL)' the first time it is expected to show 'undefined', but the second time it should have shown the URL.
What do you see instead?
'express-session' or 'connect-mongo' does not work normally in Bun JS. Normally, a session object is created only once in a browser, but when using it with Bun JS using ' req.session.previousURL = { previousURL: req.url }' it creates a new session object each time instead of updating that existing session object. And when doing 'console.log(req.session.previousURL)' the first time it is expected to show 'undefined', but the second time also it shows 'undefined' where it should have showed the url.
Additional information
I am a full stack web developer, I used Node JS and Express JS, but now I use Bun JS and Express JS because of it's incredibly fast performance. I don't use Elysia JS because I know Express JS better and sometimes it is faster.