jlarmst
jlarmst8mo ago

v11 `Invalid Content-Type header`

The most recent update of v11 seems to break with:
Invalid Content-Type header. This request may not be supported by your tRPC Adapter, or possibly by tRPC at all
Invalid Content-Type header. This request may not be supported by your tRPC Adapter, or possibly by tRPC at all
The related commits in the rc.346 are probably: - https://github.com/trpc/trpc/pull/5613 - https://github.com/trpc/trpc/pull/5652 I am using the react and vanilla fetch adapters, so according to the docs https://trpc.io/docs/migrate-from-v10-to-v11#explicit-content-type-checks-non-breaking my code should not be breaking I went ahead and downgraded to 11.0.0-next-beta.318 and it works fine
8 Replies
Alex / KATT 🐱
Cc @Nick Lucas @jlarmst can you create an issue? Likely a bug
Nick
Nick8mo ago
Yep a reproduction at very least woulds be super helpful 🙂
jlarmst
jlarmstOP8mo ago
Thank you for the quick reply! It’s deeply tied to my personal project, but I will try to get a reproduction tomorrow
Nick
Nick8mo ago
Sure, for now you could give us an idea of what environment the issue is appearing in. Does it happen locally? Any reverse proxy etc? How are your links configured? The header is mandatory for the first time now, so we're suspecting something non-vanilla in the mix
julius
julius8mo ago
Can you try -rc.347 when you have the chance @jlarmst - might fix things, or atleast give you a better error
jlarmst
jlarmstOP8mo ago
Locally! Links are custom based on the SOA example because I’m trying out serverless with sst too. The only thing I wrote down to check tomorrow is that I’m setting custom headers and not setting a content-type
julius
julius8mo ago
yea that's probably the most likely reason. we currently require the content-type header to be set
jlarmst
jlarmstOP8mo ago
I’ll try adding the Content-Type: "application/json" to the defaultHeaders object I use with -rc.347 So setting any headers means that the Content-Type must also be set manually, even when using the default clients UPDATE: rc.347 did fix it. Manually setting a default header of content-type: "application/json" works in rc.347, but not rc.346 Thank you everyone for your help!