logo
down
shadow

connect-redis and express-session results in req.session undefined


connect-redis and express-session results in req.session undefined

By : user2949462
Date : November 17 2020, 01:00 AM
I think the issue was by ths following , You probably have some connection errors, but connect-redis does not output them to console (see connect-redis source code). To see them you can create a separate module that creates a client instance and pass it to RedisStore constructor:
code :
// redisClient.js
var redis = require('redis');

var redisClient = redis.createClient('localhost', 6379); // replace with your config

redisClient.on('error', function(err) {
     console.log('Redis error: ' + err);
}); 

module.exports = redisClient;
// your code
var redisClient = require('./redisClient.js`);

(...)

app.use(session({ 
    store: new RedisStore({ 
        client: redisClient
    }),
    secret: config.secret, 
    saveUninitialized: true,
    resave: false 
}));


Share : facebook icon twitter icon
'session' is undefined when using express / redis for session store

'session' is undefined when using express / redis for session store


By : Teodor
Date : March 29 2020, 07:55 AM
This might help you I'm trying to use redis for sessions in my express app. , Looks like you're missing:
code :
app.use(express.cookieParser());
req.session undefined with express and connect-redis

req.session undefined with express and connect-redis


By : Ed Anderson
Date : March 29 2020, 07:55 AM
like below fixes the issue The cookieParser middleware needs to come before the session middleware so swap the order like this:
code :
   app.use(express.cookieParser());
   app.use(express.session({ secret: 'p!550ff', store: new RedisStore }));
'session' is undefined - Este JS / Express / Redis for session store

'session' is undefined - Este JS / Express / Redis for session store


By : Tension Coding
Date : March 29 2020, 07:55 AM
should help you out The problem was solved. isomorphic-fetch don't send Cookies to server
https://github.com/matthew-andrews/isomorphic-fetch/issues/89
How to use redis store in express session using connect-redis?

How to use redis store in express session using connect-redis?


By : Ravikumar R
Date : March 29 2020, 07:55 AM
hope this fix your issue I'm assuming you want to store and read values from the session (using the express-session module) and not use redis directly. For this you'll want to use the req.session object in a request.
Checkout the functions here in the documentation - https://github.com/expressjs/session#reqsession
NodeJS / express / connect-redis: no error on redis being down; session missing

NodeJS / express / connect-redis: no error on redis being down; session missing


By : Corey Laird
Date : March 29 2020, 07:55 AM
With these it helps connect-reddis listens to redis for the error event
./lib/connect-redis.js
Related Posts Related Posts :
  • Tuning node-mongodb-native connection pool size
  • Express Socket.io example server not working
  • node js can't install right on my Ubuntu computer
  • How can i do an "or" query in a Model.find on Sails?
  • Confused in starting a project in node.js with npm install
  • unit testing express route with async callback
  • Mongoose sum operation in collection
  • document save function not working in mongoose
  • Why is the zlib inflate function is not working in correct order in node.js?
  • Nested if inside each (Handlebars template in Express app)
  • How does the cookie-session middleware work in expressjs?
  • grunt-processhtml remove not working when specifying a target
  • Error: CERT_HAS_EXPIRED in Node.js request module (macu vs facebook)
  • Async web requests are making 'socket hangup' in node.js
  • ExpressJS: Middleware control flow for Router.param() & Router.use()
  • Glob recursive/zero or more directories, excluding directories
  • node.js v0.11.14 as service with --harmony
  • Running npm install from Sublime Text 2 doesn't work
  • update on a subdoc with mongoose
  • NodeJS Aerospike UDF execute memory leak
  • Alternative to path module that always uses forward-slashes?
  • How do you stream a csv file into a node web app?
  • How to modularize routing with Node.js Express
  • NodeJS - Modularising SQLite3
  • MongoDB / Node: Incorrect Arguments
  • How to use Aggregate in mongoose
  • How to generate multiple reports with mocha?
  • AWS Lambda making video thumbnails
  • MEAN stack on Ubuntu 14.04 suddenly stopped working
  • node.js/express/mongoose noob issue
  • Nodejs ssh convert output byte stream to a sliceable string
  • different behavior of process.argv
  • How to expose the Application model's register method
  • How to install FFMPEG on Node/Meteor server?
  • How Can I Use vhost to Redirect a Sub-Domain to an ExpressJS Route?
  • Gmail API not respecting UTF encoding in subject
  • installing Node modules on Docker: why are they disappearing?
  • How do I set up Node/Express to act as a STUN server?
  • What is the Linear Execution Model in Meteor?
  • Application Error Heroku - Problems with Deployment
  • How to pass node v8 args and script args to pm2?
  • Can it be necessary to require a module (child_process in this case) more than once?
  • Too many bad command: outbound emails with Haraka
  • what does require("child_process") actually do?
  • How can I list all my Amazon EC2 instances using Node.js in AWS Lambda?
  • Passing param to custom middleware
  • How do I debug "Error: spawn ENOENT" on node.js?
  • Proper way to combine route and api auth using loopback.js
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org