K
Kindeβ€’10mo ago
Ruyy

Next.js 14.0.3 Middleware TypeError

Subject: Assistance Needed with TypeScript Error in Kind Auth Implementation Hey there! πŸ‘‹ I hope this message finds you well. I'm currently using Kind Auth for the first time, and I've encountered a TypeScript error while trying to access a protected route. Following the Next.js starter kit, I've set up the protected route at /dashboard. However, every time I attempt to access it, I'm confronted with the following error: Server Error TypeError: Cannot read properties of undefined (reading 'value')
3 |
4 | export default function middleware(req: NextRequest) {
> 5 | return withAuth(req);
| ^
6 | }
7 |
8 | export const config = {
3 |
4 | export default function middleware(req: NextRequest) {
> 5 | return withAuth(req);
| ^
6 | }
7 |
8 | export const config = {
Interestingly, despite this error, the authentication seems to be working fine. The user exists and is successfully populated in the database. I'd greatly appreciate any guidance or assistance you can provide in resolving this issue. Thanks a bunch! πŸ™ Github Repo: https://github.com/ruymon/revivi/tree/5ced50b82d94c4c329fde3709701746cf6ea2355
GitHub
GitHub - ruymon/revivi at 5ced50b82d94c4c329fde3709701746cf6ea2355
revivi. Contribute to ruymon/revivi development by creating an account on GitHub.
11 Replies
Oli - Kinde
Oli - Kindeβ€’10mo ago
Hi @Ruyy, Thanks for flagging that your issue here is a duplicate of https://discord.com/channels/1070212618549219328/1179721063450546206 I can see in your repo that you are using the Kinde NextJS SDK v2.0.10 As mentioned in https://discord.com/channels/1070212618549219328/1179721063450546206, our NextJS expert teammate is looking into this issue. I will get back to you once we have more information.
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Ruyy
Ruyyβ€’10mo ago
Thanks!
Oli - Kinde
Oli - Kindeβ€’10mo ago
Hey @Ruyy, As mentioned in https://discord.com/channels/1070212618549219328/1179721063450546206/1179721063450546206, you should be able to use the middleware in NextJS App Router v1 to achieve what you are after: https://kinde.com/docs/developer-tools/nextjs-sdkv1/#protecting-pages Please let me know if you come across any other issues.
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Kinde Docs
NextJS App Router SDK v1 - Developer tools - Help center
Our developer tools provide everything you need to get started with Kinde.
Ruyy
Ruyyβ€’10mo ago
Noted.
Oli - Kinde
Oli - Kindeβ€’10mo ago
Hey @Ruyy, As mentioned in https://discord.com/channels/1070212618549219328/1179721063450546206, there is a new version of the NextJS SDK v2.0.11 that fixed this middleware issue. Please let us know if you are still experiencing any issues.
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Ruyy
Ruyyβ€’10mo ago
Hey, @Oli - Kinde ! I confess that I had changed the auth in that project cuz I was not sure how long till the issue was fixed but you guys are blazing fast πŸ˜‚
Oli - Kinde
Oli - Kindeβ€’10mo ago
We work at lightning speed here ⚑ , we don't let issues like this get dust on them.
Want results from more Discord servers?
Add your server