Nodejs Express Prisma-Session商店奇怪错误
软件包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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误消息说
data
的列值太长。这是session
模型上的一个字段,在您的schema.prisam
中 prisma会话商店说要创建。我认为您必须使该列更大。我不知道您使用哪个数据库,但以下是文档用于字符串。如果您在
schema.prisma
中像ThisData String
一样设置它,请根据数据库检查文档是否为字符串的默认值。您可以添加
数据字符串 @db.varchar(< insert Length在此处>)
以明确设置字符长度。The error message says the column value for
data
is too long. This is a field on theSession
model, in yourschema.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 yourschema.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.