在Remix的笑话应用教程中,我在session.server.ts中获得用户的过程中出现了一个错误。
我认为这个错误是关于Prisma的,但我不知道如何解决。
网址:https://remix.run/docs/en/v1/tutorials/jokes#authentication
TypeError: Cannot read properties of undefined (reading 'findUnique')
at login (/usr/src/app/remix-jokes/build/index.js:700:30)
at action2 (/usr/src/app/remix-jokes/build/index.js:751:26)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.callRouteAction (/usr/src/app/remix-jokes/node_modules/@remix-run/server-runtime/data.js:36:14)
at async renderDocumentRequest (/usr/src/app/remix-jokes/node_modules/@remix-run/server-runtime/server.js:216:24)
at async requestHandler (/usr/src/app/remix-jokes/node_modules/@remix-run/server-runtime/server.js:55:20)
at async /usr/src/app/remix-jokes/node_modules/@remix-run/express/server.js:45:22它似乎发生在下面的代码中的findUnique调用中。
export async function login({
username,
password
}: LoginForm) {
const user = await db.user.findUnique({
where: { username }
});
if (!user) return null;
const isCorrectPassword = await bcrypt.compare(
password,
user.passwordHash
);
if (!isCorrectPassword) return null;
return user;
}发布于 2022-02-03 02:48:24
我重新启动了码头集装箱,解决了问题。谢谢。
https://stackoverflow.com/questions/70942798
复制相似问题