Tutorial-chapter 4-authentication-signup/login page issues

I’m following the official tutorial step by step till chapter 4 ( Authentication | RedwoodJS Docs ), after I ran " yarn rw g dbAuth" , the login page didn’t show as the tutorial said and there are some error messages as below:

and the signup page showed but I couldn’t signup a new user, error messages :

Invalid db.user.create() invocation in

103 // If this returns anything else, it will be returned by the
104 // signUp() function in the form of: { message: 'String here' }.
105 handler: ({ username, hashedPassword, salt, userAttributes }) => {
→ 106 return db.user.create({
data: {
email: ‘wei@email.com’,
hashedPassword: ‘e2221050023a1565daf4c1be4faddecf436ee0f55cfd0b787c0f688e1d801e0e’,
salt: ‘37bc5ef9250ed3e5436421c1295a0363’,
+ hashedPassWord: String,
? name?: String | null,
? resetToken?: String | null,
? resetTokenExpiresAt?: DateTime | null

Unknown arg hashedPassword in data.hashedPassword for type UserCreateInput. Did you mean hashedPassWord?
Argument hashedPassWord for data.hashedPassWord is missing.

Note: Lines with + are required, lines with ? are optional.

Would appreciate it if I could get some tips on how to fix it so that I could keep going with the tutorial!

When you ran yarn rw setup auth dbAuth did you tell it to enable WebAuthn support? And then did you give the same answer when you ran yarn rw g dbAuth? Try running them both again and adding the --force flag, and answering “no” to both, to keep the code simpler.

That error looks like you named your field in schema.prisma as hashedPassWord (capital ‘W’) instead of hashedPassword (lowercase ‘w’), which is what all of the generated code assumes it is. You can change your schema.prisma file and re-migrate, or go through all of the generated code and search for hashedPassword, replacing it with hashedPassWord. I’d just update the schema file, myself! :slight_smile:

1 Like

Hi Rob, Thank you very much for the swift support. Appreciate it!

The tip to update schema file worked very well. I replaced “hashedPassWord” with “hashedPassword”, and the signup page is back to normal!

Login page was not fixed, though. The “webAuthn is undefined” error was still there. I tried to delete the SignupPage and LoginPage and run the two commands to generate two pages again and the error became “cannot find LoginPage…” Maybe it’s the consequence of my previous schema problem?

I started the tutorial project again and it now works nicely. Thanks!

1 Like

Excellent! So you started over and you got back to the authentication section, and now it’s working?

That error sounds like something was missing from api/src/functions/auth.js which is where that webAuthn key should be defined, with options. If you had run yarn rw setup auth dbAuth and said no to WebAuthn support, it would not include those options. But if you then ran yarn rw g dbAuth and said yes to WebAuthn support, you would get the error you’re describing, because that webAuthn options object doesn’t exist.

1 Like

Got it! Next time if I run into a similar error I know where to check.

Yes, the new project I started over has no authentication issues any more.

Thank you very much, Rob!

1 Like