Nodejs Express Prisma-Session商店奇怪错误

发布于 2025-02-10 18:21:54 字数 1732 浏览 1 评论 0原文

软件包Prisma-Session商店拒绝工作 这是我的设置

  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
    }
  })
);

,我有这个奇怪的错误 知道Prisma在包装外工作完美

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)```

The package prisma-session-store refuses 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 prisma 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)```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

因为看清所以看轻 2025-02-17 18:21:54

错误消息说data的列值太长。这是session模型上的一个字段,在您的schema.prisam prisma会话商店说要创建。我认为您必须使该列更大。我不知道您使用哪个数据库,但以下是文档用于字符串。

如果您在schema.prisma中像This Data String一样设置它,请根据数据库检查文档是否为字符串的默认值。

您可以添加数据字符串 @db.varchar(< insert Length在此处>)以明确设置字符长度。

The error message says the column value for data is too long. This is a field on the Session model, in your schema.prisam that prisma session store says to create. I think you'll have to make that column larger. I don't know which database your using but here are the docs for a string.

If you set it up like this data String in your schema.prisma then check the docs for the default value of string based on your database.

You can add data String @db.VarChar(<insert length here>) to explicitly set the character length.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文