Next.js Discord

Discord Forum

better auth

Unanswered
Cuban Crocodile posted this in #help-forum
Open in Discord
Cuban CrocodileOP
im really struggling to make this sign in page work, its my first time, if anyone is able to help pls

9 Replies

@erikcodez Hey, what exactly do you need help with? Did you read the docs? What exact part are you struggling with? Do you have any errors? https://better-auth.com/docs/integrations/next https://better-auth.com/docs/basic-usage https://better-auth.com/docs/authentication/email-password
Cuban CrocodileOP
# SERVER_ERROR:  Error [PrismaClientValidationError]: 
Invalid `db[model].findFirst()` invocation in
/Users/yusuf/Documents/NEA tuition webapp/Frontend/.next/dev/server/chunks/[root-of-the-server]__19pwejr._.js:7681:52

  7678     map.set(key, getModelName(joinModel));
  7679 }
  7680 const selects = convertSelect(select, model, join);
→ 7681 const result = await db[model].findFirst({
         where: {
           username: {
           ~~~~~~~~
             equals: "juhug"
           },
       ?   AND?: UserWhereInput | UserWhereInput[],
       ?   OR?: UserWhereInput[],
       ?   NOT?: UserWhereInput | UserWhereInput[],
       ?   id?: StringFilter | String,
       ?   email?: StringFilter | String,
       ?   name?: StringNullableFilter | String | Null,
       ?   emailVerified?: BoolFilter | Boolean,
       ?   image?: StringNullableFilter | String | Null,
       ?   createdAt?: DateTimeFilter | DateTime,
       ?   updatedAt?: DateTimeFilter | DateTime,
       ?   posts?: PostListRelationFilter,
       ?   sessions?: SessionListRelationFilter,
       ?   accounts?: AccountListRelationFilter
         },
         select: undefined
       })

Unknown argument `username`. Available options are marked with ?.
    at ignore-listed frames {
  clientVersion: '7.8.0'
}
 POST /api/auth/sign-in/username 500 in 869ms (next.js: 641ms, application-code: 228ms)
Yellow Wagtail
Your schema might not be valid. Check the docs. Try to generate the schema again
@erikcodez Oh alright, could you also send your code of the email-password sign in method?
Cuban CrocodileOP
ok i’ll send when i use my laptop
i’m using username and password
this stuff seems kinda complicated ngl
@Cuban Crocodile this stuff seems kinda complicated ngl
Yellow Wagtail
You can use the CLI.
https://better-auth.com/docs/adapters/prisma generate the schema using the better-auth CLI.