Middleware not running in prod, but localhost
Unanswered
Magnificent Frigatebird posted this in #help-forum
Magnificent FrigatebirdOP
Absolutely stumped by this. My middleware.ts isn't working in production, but it is working in localhost. Any ideas
21 Replies
where are you deploying your app?
Magnificent FrigatebirdOP
@Anay-208 on vercel
can you send your file structure?
Magnificent FrigatebirdOP
once again, I know this middleware is working in localhost (seeing the logs). and when i deploy to vercel, it does pick up the paths:
but the actual triggering is not occuring in vercel
Umm, did you try putting a console.log on middleware to verify?
Magnificent FrigatebirdOP
Yes:
Which route do you face this issue in? is that route cached or something?
Magnificent FrigatebirdOP
every single route, middleware doesnt run anywhere
and when i disable cache in chrome nothing changes
I had two ideas:
First one is that caching during upload could be causing this. Have been looking into how to deploy as a hard reset
Second one is that within updateSession, maybe my ENVs aren't being initalized properly causing the whole thing to not run?
First one is that caching during upload could be causing this. Have been looking into how to deploy as a hard reset
Second one is that within updateSession, maybe my ENVs aren't being initalized properly causing the whole thing to not run?
But I'm really desparate and speculating at this point LOL
can you send the matcher of your middleware? I'll check it out tmr
Magnificent FrigatebirdOP
export const config = {
matcher: [
'/((?!api|_next/static|_next/image|favicon.ico|public|upgrade|account/membership).*)',
]
}
Thanks, Also, take a look at this for future ref
Magnificent FrigatebirdOP
My bad!
Alright, will check this out tmr!
And @Magnificent Frigatebird whats your nextjs version?
Magnificent FrigatebirdOP
@Anay-208 was on 14, updated to stable release of 15 and this is still happening
Will check this out. Can you tell a route on which middleware isn't running and it is supposed to run at?