Giter VIP home page Giter VIP logo

Comments (3)

seanmonstar avatar seanmonstar commented on June 14, 2024

Likely, somewhere in the code, the session object is being set to something that isn't a client-sessions session.

Likely somewhere, this is happening: req.session = someOtherObject; If someOtherObject doesn't have a reset method, then that's why you get that error.

from node-client-sessions.

seanmonstar avatar seanmonstar commented on June 14, 2024

We could do some things to try to handle this better:

  1. We could use Object.defineProperty() to make the property read only. That way, an error will be thrown right when people try to change the value, since quietly doing nothing means that the sessions just stop working.

  2. We could also try to be clever with Object.defineProperty() to define a getter/setter. I expect it would most often occur like this:

    req.session = { user: foo@bar.com, registered: true };

    In that case, it may be helpful to in a setter to iterate over the object and assign each property to the real session object. The downside, is that this could be too clever. Especially if it is assumed that the object assigned will still have methods from it's prototype. Maybe it's best just to error.

from node-client-sessions.

Fyrebox avatar Fyrebox commented on June 14, 2024

Thanks a lot for your prompt response. I actually was using connect's built-in session along with client-sessions because I needed it with Passport.js. that was the problem. Unfortunately I had to stop using client-sessions to handle OpenId sign up and sign in. Cheers

from node-client-sessions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.