I walked through the blog tutorial, with two notable differences… I wanted to better understand the cuid
support, so I changed all id ints to cuids; and I wanted to check out the WebAuthn (device login) support, so I enabled WebAuthn when it asked during the tutorial.
I created the UserCredential schema/table and everything seems to be almost working, during signup, I am prompted to enter my device authn (in this case, my PIN on Windows/Edge), but then receive the following error, which I am unable to resolve:
The app is receiving a 400 Bad Request:
With the error:
{“error”:“Cannot destructure property ‘id’ of ‘response’ as it is undefined.”}
There are no line numbers or stack here in the output and I see nothing helpful in the redwood logs, so I’m feeling a bit stuck. Does anyone have any tips on how I might track this down?
P.S. I am absolutely loving Redwood!!!
Oh… did find a stack in the console:
Which refers to this section in LoginPage.tsx:
const onRegister = async () => {
try {
await webAuthn.register()
toast.success(WELCOME_MESSAGE)
navigate(REDIRECT)
} catch (e) {
toast.error(e.message)
}
}
Could you share your repo?
Changing a database schema model where the primary key used integers ids to cuid (which are strings) has *lots * of downstream impact.
Helpful errors would be api side logs rather than in the web console however.
Did you:
- migrate your database
- update all SDL
- update all scenario tests data
- regenerate the Prisma client and graphql types
- restart the dev server
- properly configure dbAuth for any id changes
?
Sure! Here’s the repo: payneio/redwoodblog: Blog example for Redwood framework. (github.com)
I believe I’ve done all of the above steps. Except I’m sure I missed something in the “properly configure dbAuth for any id changes”
Wait, you are on Windows Edge with PIN auth?
I don’t believe that’s supported.
See Self-hosted Authentication (dbAuth) | RedwoodJS Docs
And Server | SimpleWebAuthn
Did it work prior to changing to use cuid?
I tried with cuid first, so I don’t know if it worked. Unfortunate that Edge is not supported… same engine as Chrome now, so doesn’t seem like it would be that big of a deal… and you know 11% market share, which is above Safari and Firefox.
In any case, I get the same error in Chrome on Win 11.