Git Product home page Git Product logo

Comments (6)

dougwilson avatar dougwilson commented on May 17, 2024

You store.generate function must be sync. You are not supposed to actually create the session in the store at that time. You should be waiting for the store.set call to create the entry in your storage system.

from session.

dougwilson avatar dougwilson commented on May 17, 2024

if other middleware layers (eg, authentication/authorization) are expecting the session to exist in the datastore.

They should only access the session using req.session; perhaps we can add some kind of option to allow for saving the session to the store up-front, like you are wanting.

from session.

japherwocky avatar japherwocky commented on May 17, 2024

The store implementation doesn't actually define generate, only set. So the store I'm using has properly set up an async set, but because of how generate gets called, it doesn't matter.

And now that i've dived into the code, I realize that it should only be using req.session, as you say, which is probably totally reasonable, but it was a pretty big gotcha before I figured it out!

So maybe a feature request, maybe just a call out in the docs would do.

from session.

dougwilson avatar dougwilson commented on May 17, 2024

The store implementation doesn't actually define generate, only set.

Correct, but you made it sound like you were over-writing this, so I assumed you were redefining it. Apparently not, so yes, it doesn't even get save to the database until the request that created the session has completed.

from session.

gireeshpunathil avatar gireeshpunathil commented on May 17, 2024

@japherwocky - is this still an issue for you? are you good with @dougwilson 's explanation to your concerns?

from session.

japherwocky avatar japherwocky commented on May 17, 2024

Sorry, this was so long ago, I have no idea if it's an issue for that project anymore. Feel free to close the issue!

from session.

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.