fastify-session icon indicating copy to clipboard operation
fastify-session copied to clipboard

Warning using fastify 3.9.x

Open TMantas opened this issue 3 years ago • 4 comments

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

TMantas avatar Dec 16 '20 08:12 TMantas

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!

aspiiire avatar Feb 09 '21 10:02 aspiiire

Is this an abbandoned repo? Should remove from https://www.fastify.io/ecosystem/ ...

BCsabaEngine avatar Jul 25 '21 14:07 BCsabaEngine

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 avatar Jul 25 '21 15:07 BCsabaEngine

@BCsabaEngine we made an official fork of this repo to continue the work started here. See https://github.com/fastify/session

zekth avatar Aug 04 '21 08:08 zekth