'Error about Prisma in Remix's Jokes App tutorial
In Remix's Jokes App tutorial, I got an error in the process of getting a user in session.server.ts.
I think the error is about Prisma, but I don't know how to solve it.
url: 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
It seems to occur in the findUnique call in the following code.
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;
}
Solution 1:[1]
I restarted the Docker container and that solved the problem. Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hiroki |
