koa-session2 icon indicating copy to clipboard operation
koa-session2 copied to clipboard

TypeError: store.getID is not a function

Open RobertPrediger opened this issue 4 years ago • 3 comments
trafficstars

In version 2.2.10, there is an error.

In index.js there is a call with:

 id = await store.getID(24);

But in store.js the function getID is not a promise:

getID(length) {

Result is:

TypeError: store.getID is not a function
   at /opt/aplus/dev/server/node_modules/koa-session2/index.js:17:34

RobertPrediger avatar Jan 30 '21 22:01 RobertPrediger

@RobertPrediger what version of node do you use? I think the await keyword is compatible with the synchronization function.

Secbone avatar Feb 07 '21 06:02 Secbone

@Secbone I am using 14.15.4

As a workaround, if I remove the await, it's working.

RobertPrediger avatar Feb 07 '21 12:02 RobertPrediger

@RobertPrediger Do you use a custom store object? I think if it is an async function problem, it will be failed at this line https://github.com/Secbone/koa-session2/blob/9ee7b2696f4f77bbaa354e3201952f754e98196e/index.js#L12-L14 before the getID function. 🤔

Secbone avatar Feb 09 '21 02:02 Secbone