v11 `Invalid Content-Type header`
The most recent update of v11 seems to break with:
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 fine8 Replies
Cc @Nick Lucas
@jlarmst can you create an issue? Likely a bug
Yep a reproduction at very least woulds be super helpful 🙂
Thank you for the quick reply! It’s deeply tied to my personal project, but I will try to get a reproduction tomorrow
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
Can you try
-rc.347
when you have the chance @jlarmst - might fix things, or atleast give you a better errorLocally! 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
yea that's probably the most likely reason. we currently require the content-type header to be set
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!