TRPC clerk middleware error in middleware.ts

Following along with the t3 stack tutorial and getting an error in the terminal even though i have defiend the withClerkMiddleware function inside my middleware.ts
12 Replies
kdiffin
kdiffinOP•2y ago
this is how my files look like if that matters
James Perkins
James Perkins•2y ago
Change your middleware matcher to
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next
* - static (static files)
* - favicon.ico (favicon file)
*/
"/(.*?trpc.*?|(?!static|.*\\..*|_next|favicon.ico).*)",
"/"
],
};
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next
* - static (static files)
* - favicon.ico (favicon file)
*/
"/(.*?trpc.*?|(?!static|.*\\..*|_next|favicon.ico).*)",
"/"
],
};
kdiffin
kdiffinOP•2y ago
@James Perkins still drops the same error
kdiffin
kdiffinOP•2y ago
kdiffin
kdiffinOP•2y ago
also one weird interaction i found out is if i move the middleware.ts from pages to the src folder it starts infinitely rerendering the page
James Perkins
James Perkins•2y ago
Is your clock correct 🙂
kdiffin
kdiffinOP•2y ago
Its 4 mins late... lol thanks for pointing that out
James Perkins
James Perkins•2y ago
Sounds like your clock is skewed further than our clock allows. Fix your clock restart the server and try again.
kdiffin
kdiffinOP•2y ago
alright why does the clock affect this tho by the way
James Perkins
James Perkins•2y ago
because JWT have an expiration date. so we try to issue you another but i's already expired according to your system clock. So your JWT is never valid.
kdiffin
kdiffinOP•2y ago
it worked!!! thank you so much would've never figured this out myself
James Perkins
James Perkins•2y ago
have a great day! 😄
Want results from more Discord servers?
Add your server