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 fineAK
Alex / KATT 🐱•17d ago
Cc @Nick Lucas
@jlarmst can you create an issue? Likely a bug
N
Nick•17d ago
Yep a reproduction at very least woulds be super helpful 🙂
J
jlarmst•17d ago
Thank you for the quick reply! It’s deeply tied to my personal project, but I will try to get a reproduction tomorrow
N
Nick•17d 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
J
julius•17d ago
Can you try
-rc.347
when you have the chance @jlarmst - might fix things, or atleast give you a better errorJ
jlarmst•17d 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
J
julius•17d ago
yea that's probably the most likely reason. we currently require the content-type header to be set
J
jlarmst•17d 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!4.8KMembers
View on DiscordMore Posts
Calling procedures from Next server actionsHi, is using trpc client allowed in server actions? I have two use cases, in one i call procedure frTRPC Typescript auto serialize errorThe inferred type of this node exceeds the maximum length the compiler will serialize. An explicit tTRPC with MSWDoes anyone have a basic example on how to set up MSW in a React Vite TRPC env?
My main question isRevalidate / invalidate in server componentsIs there a solution for TRPC query invalidation (or revalidating), passing the actions from the clieTypescript type error with latest versionI'm initialising a project with trpc v11 and I'm trying to strictly follow the documentation for reaDon't understand cacheHow come my API is still getting called when it's already been called with other inputs?
Ex:
1. api The inferred type of this node exceeds the maximum length the compiler will serialize.I'm facing this issue. The inferred type of this node exceeds the maximum length the compiler will sGetting strange react error in nextjsI am getting a strange Error Message when nextjs tries to compile:
```js
TypeError: react__WEBPACK_Error on NextJs AppRouterAnyone knows why this is showing on my console?TRPC Dynamic Procedure URLI am currently using QStash as a message queue with TRPC. QStash is HTTP-based and in the example beIs it possible to get the procedure name / id in middleware?I want to create a caching middleware that in some routes, stores a cache key that contains the routqueries and mutations has wrong response type in client ( monorepo )tRPC + React Query Data Invalidation?Hey y'all, I'm working with tRPC and React Query and just trying to understand how this works. I havtrpc optimistic updates causing data flickerI'm trying to add optimistic updates to a calendar component but when the mutate function is called > Error: Invariant: headers() expects to have requestAsyncStorage, none availableHi, I use trpc v1045.1 in next 14.1 app router. I call it server side and have the following.
```js
How do I exclude properties while returning data?I basically need to create a dto's that would exclude properties like access keys etc. while returniDoes anyone have an example of subscriptions implemented in CloudFlare Workers?I'm trying to use subscriptions via WebSocket in CloudFlare Workers, but it's been a real pain so faTRPCClientError: Unable to transform response from serverI am currently encountering this error occasionally in my apps. I am using a Monorepo, which includeUnexpected tokenWorks fine locally, doesn't work when deployed to AWS via sst.dev. Was working last night. RedeployeContext is not being passed correctlyI will include my setup at the end. My problem is that I am using nextauth with database sessions an