input needs to be an object when doing a batch call?
Hey folks, just setup tRPC and running into the above error when trying to run mutations. Queries, even with inputs, work fine. Am I doing something wrong?
7 Replies
If I look at the request, it's a POST request with a
?batch=1
query param. The body is {"0":{"foo":"bar"}}
This all looks fine
Could you show the exact error? And share any more complete code?
Stripping out the gist of the code for an example often seems helpful but when it's likely to be a coding mistake it actually hides useful information from us
The above is copy pasted verbatim, except that the
mutateAsync
call happens in an onClick
handler...
Full(er) error:
Maybe it has to do with the way my server is setup...Could be, we’re into some weeds that I’m not too familiar with here
All good, I think it might be my server setup. It's a bit unusual. Thanks for the help!
Might be worth trying one of the example/starter projects and bringing over some work to or from it. Would give you a basis for comparison at least!
Maybe someone else here recognises the issue though, good luck!
The body that's coming in from my server is of 0 length so looks like that's the problem 🙃
Thanks again!