koajs / generic-session

koa session store with memory, redis or others.
MIT License
414 stars 65 forks source link

TypeError: Cannot set property name of which has only a getter #138

Closed eraare closed 3 years ago

eraare commented 3 years ago

TypeError: Cannot set property name of which has only a getter

Hi, Gus! I cannot understand the APIs of this module. When I use it like this: session.name = 'Koa', there will be an "TypeError: Cannot set property name of which has only a getter" occured. Who can help to explain this problem?

niftylettuce commented 3 years ago

I have just fixed this in the latest release as I encountered it myself. Sometimes an err object is thrown but the name property is restricted to only having a getter and not being able to be changed.

https://github.com/koajs/generic-session/releases/tag/v2.1.2

Ref: https://github.com/koajs/generic-session/commit/9a8ecbf37d50cf35d43c69e9f3363b28960caff2#diff-ec75bebb1866d99ac5e8cd807271745cd953b9df4a04878239ec836582672e59L489-R494