tRPCttRPC
Powered by
LambertL
tRPC•11mo ago•
3 replies
Lambert

NextJs trpcClient and merged router. But it is returning a html doc instead of json error.

I am new trpc, I am implementing a single
trpcClient 
trpcClient 
and merged router,
in nextJs v15, app router.

When i implement trpc with api routes
/api/v2/user/[user]/route.ts
/api/v2/user/[user]/route.ts
and utils/trpc nexbacthlink
/api/v2/user
/api/v2/user
. this code snippet is working fine.

I encountered an error, when change the routes to
/api/v2/route.ts
/api/v2/route.ts
and utils/trpc nexbacthlink to
/api/v2
/api/v2
. the request to server
/api/v2/updateUserStatus
/api/v2/updateUserStatus
is
200
200
but it's returning a
Not Found Page in next js
Not Found Page in next js
instead of a
json
json
.

Does anyone know how to fix this issue?
code-snippet.txt2.88KB
Solution
Oh, I see now, I fixed the issue by adding
api/v2/[trpc]/route.ts
api/v2/[trpc]/route.ts
. It working now with this.
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

trpcClient
Ali SamadiAAli Samadi / ❓-help
4mo ago
Returning html with TRPC
RyanRRyan / ❓-help
3y ago
if I export 'appRouter' instead of 'router' I get error
NazCodelandNNazCodeland / ❓-help
3y ago