trpc fetch failed in server actions: Request body length does not match content-length header
Hello guys !
I was trying out the new t3-app boilerplate with the app router and in the example, we have:
- Two queries in server side (hello and latest post)
- A mutation in client side (create post)
I tried to create a mutation in server side like so:
But i have this error message: with code
Is trpc mutation supported in server actions or am I doing something impossible ?
I suspect it's due to error headers are set for trpc in the server side but i'm not sure...
7 Replies
@julius you might have the answer to this ? I don't know if it's allowed to tag people, if not, i'm sorry !
hmm looks like bad headers... try this in the link options
shouldn't need to forward every header really... cookie should be enough to get authed
Thank you for your answer !
I found a way to make it work but still need to check it broke nothing.
Previous way to set headers (giving us the error):
New way to set headers:
The first nextjs headers that was passed is empty.
I have the same error, but when I call a client side mutation. Any ideas?
These are the logs I get, it mentions a server component error which I don't understand since the mutation runs on the client.
The mutation also works, I just keep getting these logs
Detailed logs
I tried upgrading to the latest ct3a now I get