kleydon / prisma-session-store

Express session store for Prisma
MIT License
116 stars 18 forks source link

weird error after adding the package #94

Closed HosMercury closed 1 year ago

HosMercury commented 1 year ago

Hi This package refuse to work this is my settings


  session({
    store: new PrismaSessionStore(new PrismaClient(), {
      checkPeriod: 2 * 60 * 1000, //ms
      dbRecordIdIsSessionId: true,
      dbRecordIdFunction: undefined
    }),
    name: 'sid',
    secret: process.env.KEY,
    saveUninitialized: true,
    resave: true,
    cookie: {
      path: '/',
      httpOnly: true,
      secure: process.env.NODE_ENV === 'development' ? false : true,
      maxAge: 2 * 60 * 60 * 1000 // ms
    }
  })
);```

and I have this weird error 
Knowing works perfect outside the package 

```set(): Error:
Invalid `this.prisma[this.sessionModelName].update()` invocation in
/Users/hossam/wk/pim/node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:493:81

  490 case 3:
  491     _a.trys.push([3, 8, , 9]);
  492     if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 493     return [4 /*yield*/, this.prisma[this.sessionModelName].update(
  The provided value for the column is too long for the column's type. Column: data
Error:
Invalid `this.prisma[this.sessionModelName].update()` invocation in
/Users/hossam/wk/pim/node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:493:81

  490 case 3:
  491     _a.trys.push([3, 8, , 9]);
  492     if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 493     return [4 /*yield*/, this.prisma[this.sessionModelName].update(
  The provided value for the column is too long for the column's type. Column: data
    at RequestHandler.request (/Users/hossam/wk/pim/node_modules/@prisma/client/runtime/index.js:49022:15)
    at async PrismaClient._request (/Users/hossam/wk/pim/node_modules/@prisma/client/runtime/index.js:49919:18)```
kleydon commented 1 year ago

Hi @HosMercury,

The provided value for the column is too long for the column's type. Column: data

Not 100% certain, but this looks like either the database (or perhaps Prisma?) rejecting the given value for data, based on a length constraint.

kleydon commented 1 year ago

Hi @HosMercury, Just checking to see if you're still experiencing this issue.

HosMercury commented 1 year ago

The issue was the mysql text length may be .. I stopped using prisma.

HosMercury commented 1 year ago

Transferred from prisma

kleydon commented 1 year ago

Ah; got it. Hope your new solution works better!