kinde-auth-nextjs
kinde-auth-nextjs copied to clipboard
Bug: middleware with withAuth does not work: TypeError: Cannot read properties of undefined (reading 'value')
Prerequisites
- [X] I have searched the repository’s issues and Kinde community to ensure my issue isn’t a duplicate
- [X] I have checked the latest version of the library to replicate my issue
- [X] I have read the contributing guidelines
- [X] I agree to the terms within the code of conduct
Describe the issue
A simple app with one protected page using middleware does not work
import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware";
export default withAuth(async function middleware(req) {
console.log("look at me", req.kindeAuth);
});
export const config = {
matcher: ["/admin"],
};
however, when doing this, it works
import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware";
export default function middleware(req) {
return withAuth(req);
}
export const config = {
matcher: ["/admin"],
};
This is the error I'm getting
I don't have any special setup in-place. Just a public page with a <Link>
to a protected page.
Library URL
https://github.com/kinde-oss/kinde-auth-nextjs
Library version
2.2.4
Operating system(s)
macOS
Operating system version(s)
14.4.1
Further environment details
No response
Reproducible test case URL
No response
Additional information
No response
Hey, Seems like it can be the same issue happened to me: https://github.com/kinde-oss/kinde-auth-nextjs/issues/151
released 2.2.5-1 which should resolve this issue