berni
TTCTheo's Typesafe Cult
•Created by berni on 12/11/2023 in #questions
Caching trpc responses when calling from edge to serverless (vercel)
Has anyone had luck caching trpc responses when making fetch calls from edge function to a serverless function (deployment on vercel). I never seem to be able to get the cache working in such setup.
Example code snipped in the edge function:
Then in
/pages/api/trpc/[trpc].ts
I've got the follownig in order to add a cache header.
when checking the vercel logs I'm aways gettint a cache MISS and I never see the cached value being returned.
Inspecting the response headers that get to edge function recieves, it looks that the cache-control is getting stripped and replaced with different value (public, max-age=0, must-revalidate
)4 replies