useMutation throwing 500 errors
I've setup my next 13 app router project and started using some queries that worked fine, however the only route I have for mutations fails without any detailed error. I'm using the
createTRPCReact
with a custom client for RSC.
my trpc-client creator
6 Replies
traced back the error down to
httpUtils
as shown in the first screenshot
full error thrown from
Same error for me
totally blocked by this tbh
okay after digging more into this I think I found the issue, probably the return data of the router mutation isn't being sent as
Response
, just tried it on a standalone api route handler and this works: so a) it's not my db, b) probably the adapter used is not parsing the responses?
Hmm, still having the same error :/
But now I'm having it on GET() as well:
Error: Attempted to call GET() from the server but GET is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.
wait that's weird are you using
app/api/<your_route_name>/route.ts
or with trpc app/api/trpc/[trpc]/route.ts
?The second one:
app/api/trpc/[trpc]/route.ts?
It's resolved, for some reason I was having "use client" at the top of my file. For the life of me I have no idea why I had it there.