Félix
Félix
TTCTheo's Typesafe Cult
Created by Félix on 11/1/2023 in #questions
trpc fetch failed in server actions: Request body length does not match content-length header
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):
headers() {
const heads = new Map(headers());
heads.set("x-trpc-source", "rsc");
return Object.fromEntries(heads);
}
headers() {
const heads = new Map(headers());
heads.set("x-trpc-source", "rsc");
return Object.fromEntries(heads);
}
New way to set headers:
headers() {
const heads = new Map();
heads.set("cookie", cookies().toString());
heads.set("x-trpc-source", "rsc");
return Object.fromEntries(heads);
}
headers() {
const heads = new Map();
heads.set("cookie", cookies().toString());
heads.set("x-trpc-source", "rsc");
return Object.fromEntries(heads);
}
The first nextjs headers that was passed is empty.
8 replies
TTCTheo's Typesafe Cult
Created by Félix on 11/1/2023 in #questions
trpc fetch failed in server actions: Request body length does not match content-length header
@julius you might have the answer to this ? I don't know if it's allowed to tag people, if not, i'm sorry !
8 replies