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
kdiffin•14mo ago
this is how my files look like if that matters
James Perkins
James Perkins•14mo 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
kdiffin•14mo ago
@James Perkins still drops the same error
kdiffin
kdiffin•14mo ago
kdiffin
kdiffin•14mo 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•14mo ago
Is your clock correct 🙂
kdiffin
kdiffin•14mo ago
Its 4 mins late... lol thanks for pointing that out
James Perkins
James Perkins•14mo ago
Sounds like your clock is skewed further than our clock allows. Fix your clock restart the server and try again.
kdiffin
kdiffin•14mo ago
alright why does the clock affect this tho by the way
James Perkins
James Perkins•14mo 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
kdiffin•14mo ago
it worked!!! thank you so much would've never figured this out myself
James Perkins
James Perkins•14mo ago
have a great day! 😄