K
Kinde3mo ago
theo

Unable to visit /admin/*

i have a nextjs app that has an admin page with sub pages like /admin/upload /admin/store etc, it all works in localhost, but in prod i get this behaviour, where clicking on the pages, or navigating via the url sends you back to /admin/ any ideas on what it is? im using app router and protecting with matcher: ["/admin/:path*"] in middleware
11 Replies
IkiTg07
IkiTg073mo ago
Hey, i'm assuming you're using the NextJS SDK. Could you please tell me your sdk version and maybe share the code of your middleware ?
theo
theoOP3mo ago
in debugging all this i brought my middleware to the simpliet it could be at
import {withAuth} from '@kinde-oss/kinde-auth-nextjs/middleware'
export default function middleware(req) {
return withAuth(req)
}
export const config = {
matcher: ["/admin/:path*"]
}
import {withAuth} from '@kinde-oss/kinde-auth-nextjs/middleware'
export default function middleware(req) {
return withAuth(req)
}
export const config = {
matcher: ["/admin/:path*"]
}
and im using the nextjs sdk 2.3.8
IkiTg07
IkiTg073mo ago
Well this is weird because what it should be doing is send you to the kinde auth screen if you were not authenticated. Maybe it has something to do with you components / layout ? Do you have any other place where you redirect the users ?
theo
theoOP3mo ago
i dont redirect or anything, and i will admit that its some bad code, but notrhing that should be causing this, especially since the user is already authenticated, and it only happens on prod, on localhost it behaves as normal
IkiTg07
IkiTg073mo ago
This is weird. Maybe one token is getting lost somewhere or some. Have you tried to debug using the console in prod ? Like network tab, check the cookies, etc ? Let me ask the team too
theo
theoOP3mo ago
i’ll try that when i get back, and if you need access to the repo i can give it
IkiTg07
IkiTg073mo ago
Hey @theo just checking if you got anything new ?
theo
theoOP3mo ago
this is what happens with my cookies, and the logs just show 200s but i dont know if that is normal behaviour
No description
IkiTg07
IkiTg073mo ago
This is some odd behavior. May you give me a quick access to your repo ?
theo
theoOP3mo ago
since its a school project it has to be in a private repo can i just add you to it
IkiTg07
IkiTg073mo ago
yes
Want results from more Discord servers?
Add your server