Clerk auth() called on a route with file extension in T3 stack
Hi all. Having some issues with T3 and Clerk when i navigate to a route with any extension '/foo.bar'. I get the following error: I assume the middleware is working correctly as clerkMiddleware shouldn't be applied to this non existent route/file. Also if i type go to '/foo' i get the correct 404 page, served by not-found.tsx. Everything else is working in my app but it's just i'm seeing on my server logs when random bots are trying '/wp-login.php' it's reporting this error. So I'm wondering if it's something to do with tRPC setup in my T3 setup? Here is my src/middleware.ts:
3 Replies
src/server/api/trpc.ts /src/trpc/server.ts
src/trpc/react.tsx I've omitted getBaseUrl because of char count. All stnadard t3 app stuff.
And finally here's my errors on the server when i try to navigate to '/wp-login.php' I'm also using the following: So i'm setup for the Clerk core 2 stuff...
Oh and my 404 page: Thanks for any help in advance...oh and one other maybe curious thing is that i can't make the 404 page static...if i try and 'force-static' I get the same type of error. All my pages are ending up dynamic even though the not-found definitely shouldn't be. This happens when I build or in dev. Thanks Chris
Hey sorry just as a follow up: I think it was because I was using some Clerk auth components in my NavBar component that was then being called on any route: I've now stripped out any sort of auth checking logic from the Navbar...a bit of a shame because i wanted to check if a User was signed in and display diffferent things there. I'm sure there's a way..link to repo that helped me figure it out: https://github.com/orgs/clerk/discussions/1764
I'm now able to render statically with force-static (The ClerkProvider renders everything dynamic unless yo specify otherwise which is also a little bit of a pain)
GitHub
ClerkProvider Should Not Force All Children to Render Dynamically ·...
Preliminary Checks I have reviewed the documentation: https://clerk.com/docs I have searched for existing issues: https://github.com/clerkinc/javascript/issues This issue is not a question, general...
For anyone reading through: I was able to get the behaviour i wanted by making the NavBar a client component