-
Notifications
You must be signed in to change notification settings - Fork 457
Open
Description
When installing Redis @ 1:41h and testing the auth cookie, graphql will crash. This is because the new version of Redis (v4) doesn't support the code from the tuturial. The codeblock below will fix this. You can find the full documentation here: https://www.npmjs.com/package/connect-redis
const session = require("express-session");
let RedisStore = require("connect-redis")(session);
const main = async () => {
const orm = await MikroORM.init(microConfig);
await orm.getMigrator().up();
const { createClient } = require("redis");
let redisClient = createClient({ legacyMode: true });
redisClient.on("connect", () => console.log("Connected to Redis!"));
redisClient.on("error", (err: Error) =>
console.log("Redis Client Error", err)
);
redisClient.connect();
const app = express();
app.use(
session({
name: "qid",
store: new RedisStore({
client: redisClient,
disableTouch: true,
}),
cookie: {
maxAge: 1000 * 60 * 60 * 24 * 365 * 1, // 1 year
httpOnly: true,
sameSite: "lax",
secure: __prod__, // cookie only works in https
},
saveUninitialized: false,
secret: "bruhhhh",
resave: false,
})
);
alejosilvalau, MellisBill, swisszhang and ShariqAli-Devtonype
Metadata
Metadata
Assignees
Labels
No labels