-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connect-redis not working with latest version of node-redis client (https://github.com/redis/node-redis) #336
Comments
Ran into the same issue, just now. If you had installed the const client = createClient({
legacyMode: true
}); https://github.com/redis/node-redis/blob/master/docs/v3-to-v4.md |
@basaran are able to connect to Redis 6 instance with username and password in legacy mode. Because the reason i upgraded to @next version of node-redis is that old version send only password in auth , which doesn't support ACL in Redis 6 version. |
the legacyMode: true currently allows for using the new "redis": "^4.0.0" but without that flag, it's indeed not working The client successfully connects to redis , but loading or using session storage is not working
and
I only use redis for session storage thanks |
Any estimate when #337 will be merged? |
Not fully ready, other dependencies need to upgrade to match. Specifically connect-redis (tj/connect-redis#336)
I cannot recommend using Redis v4 at this time as it is not interoperable with Redis v3 (its |
commit 3392d67 Author: benb116 <[email protected]> Date: Sun Dec 5 23:14:57 2021 -0500 Use legacy redis client for session store commit 96b4b88 Author: benb116 <[email protected]> Date: Wed Dec 1 22:15:24 2021 -0500 Fix redis in tests Correct set, get, keys, and ttl functions. Also wait for client ready in global setup commit 3d9f31b Author: benb116 <[email protected]> Date: Wed Dec 1 22:14:17 2021 -0500 Fix HSET commit 0e23d90 Author: benb116 <[email protected]> Date: Wed Dec 1 22:11:51 2021 -0500 Fix redis key ttl setting commit 7bc261e Author: benb116 <[email protected]> Date: Wed Dec 1 17:14:23 2021 -0500 Switch to node-redis 4.0.0 Not fully ready, other dependencies need to upgrade to match. Specifically connect-redis (tj/connect-redis#336) commit 0af210c Author: benb116 <[email protected]> Date: Wed Dec 1 17:10:48 2021 -0500 Get current week not through redis
I also noticed that the maxAge isn't working right, I set to 10 years but it is only set for several months |
Redis: - redis-> redis@v3 until v4 is working stable ( tj/connect-redis#336 ) - connect-redis -> 6.0.0 - update @types/connect-redis -> ^0.0.18 and removed @types/redis since this is not necessary anymore Corrected edumeet server version deactivated spdy since it is not working anymore with node.js>15 ( spdy-http2/node-spdy#380 ) removed package-lock.json ( just support yarn, use npm at your own risk
The `legacyMode` option in `redis@v4` has matured enough such that all our tests pass now. Also includes: - Remove legacy v3 -> v4 upgrade docs - Switch to double quotes for formatting #336
Support for Redis V4 now exists through the |
The `legacyMode` option in `redis@v4` has matured enough such that all our tests pass now. Also includes: - Remove legacy v3 -> v4 upgrade docs - Switch to double quotes for formatting tj/connect-redis#336
I am removing the legacyMode requirement in the next major version of this package. If you want to try it you can Migration guide in this PR: #377 |
v7.0.0 has been released, closing |
This code snippet uses latest version of conenct redis and node-redis and req.session is setting undefined when opening app in browser.
`import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const express = require('express');
const session = require('express-session');
const app = express();
import { createClient } from 'redis';
const redisStore = require('connect-redis')(session);
const port = process.env.PORT || 8030;
const config= {
"host":"127.0.0.1",
"port":6379,
"username":"",
"password":"test"
};
async function setupsession(){
const client = createClient({ url: 'redis://default:[email protected]:6379'});
app.use(session({
secret: 'top_secrect_react_app_hub',
name: 'local.cookie',
proxy: true,
resave: false,
saveUninitialized: true,
cookie: {
secure: true,
httpOnly: true
},
store: new redisStore({ client: client }),
}
));
const val=await client.hGetAll('myhash');
const value = await client.get('field1');
console.log(value);
console.log(val);
const [ping, get, quit] = await Promise.all([
client.ping(),
client.get('key1'),
//client.quit()
]); // ['PONG', null, 'OK']
console.log(ping,get,quit);
try {
await client.get('key');
} catch (err) {
// ClosedClient Error
console.log(err);
}
}
var server = app.listen(port, function() {
console.log(
Server started on PORT ${port}
);});`
The text was updated successfully, but these errors were encountered: