#Middleware can't access variables?

5 messages · Page 1 of 1 (latest)

reef osprey
#

I have a file stored in "@/lib/sessions.js
Its a file I use to handle my sessions.
In my session.js file, I have a map called "sessionMap" which stores key(sessionIds) and value(sessions).
In this file, I also have a function called DebugSessions() which tells me the size of the "sessionMap" variable.
While passing through the middleware, the size of "sessionMap" is always 0 but if its called elsewhere (for example: route handler) the current size of the "sessionMap" is logged.
I'm assuming that middlewares can't interact with sessionMap for some reason?
Whats the work around to this?

pine owlBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

inner apex
reef osprey
inner apex
#

what exactly are you trying to do?