Next.js Discord

Discord Forum

Prisma Error

Answered
Mallow bee posted this in #help-forum
Open in Discord
Mallow beeOP
So i get this wierd error:

Invalid `prisma.user.findUnique()` invocation:

Argument `where` of type UserWhereUniqueInput needs at least one of `id`, `discordId` or `email` arguments. Available options are listed in green.


and this is my server action:
export async function getUser(userEmail) {
  const prisma = new PrismaClient();
  const user = await prisma.user.findUnique({
    where: {
      email: userEmail,
    },
  });
  return user;
}

But on the image i send it still returns the users infomation. But it still gives me the error.
Answered by Mallow bee
fixed it just need to add this line
if (typeof userEmail !== "string") return null;
View full answer

7 Replies

is your email column unique?
hmmm this is an odd error
@aardani is your `email` column unique?
Mallow beeOP
fixed it just need to add this line
if (typeof userEmail !== "string") return null;
Answer
oh it was null... xD allright
Mallow beeOP
now it works
but anyways thanks for your help
anytime!