fastify-session
fastify-session copied to clipboard
Warning using fastify 3.9.x
FastifyDeprecation: You are decorating Request/Reply with a reference type. This reference is shared amongst all requests. Use onRequest hook instead. Property: sessionStore
fastify 3.9.1 fastify-session 5.2.1
I have the same problem, I'm not really sure if is related to the package since even after commenting out the session package for me the error still shows up!
Is this an abbandoned repo? Should remove from https://www.fastify.io/ecosystem/ ...
I have changed to similar repo: @mgcrea/fastify-session
npm i @mgcrea/fastify-session
const fastifysession = require('@mgcrea/fastify-session')
const MemoryStore = require('@mgcrea/fastify-session/lib/store/MemoryStore').MEMORY_STORE
fastify.register(require('fastify-cookie'))
fastify.register(fastifysession, {
secret: SESSION_SECRET,
cookie: { maxAge: SESSION_TTL },
store: MemoryStore,
})
req.session.get + req.session.set
fastify.get('/', async (req, reply) => {
let counter = req.session.get('counter')
if (isNaN(counter))
counter = 0
counter++
req.session.set('counter', counter)
console.log(counter)
return reply.view('main', { text: 'text' })
})
@BCsabaEngine we made an official fork of this repo to continue the work started here. See https://github.com/fastify/session