Content pfp
Content
@
0 reply
0 recast
2 reactions

Michael Pfister pfp
Michael Pfister
@pfista
got caught off guard by vercels data cache... we call the hypersub smart contract to get a users remaining time via serverless function the calls are made with viem/alchemy, which uses fetch under the hood I guess vercel started caching fetch requests recently? this led to subscriptions not being recognized in our app 😞
8 replies
2 recasts
39 reactions

iain pfp
iain
@iain
You should return a cache-control header from your lambda to prevent this or do a post or add a ?tm= cache bust parameter of unixtime.
1 reply
0 recast
2 reactions

Michael Pfister pfp
Michael Pfister
@pfista
How would I do that for the call that’s in my lambda? It’s a contract call through viem to an alchemy node, afaik viem doesn’t let you control the underlying fetch settings
1 reply
0 recast
0 reaction

iain pfp
iain
@iain
https://rc.viem.sh/docs/clients/transports/http.html#fetchoptions-optional and https://vercel.com/blog/vercel-cache-api-nextjs-cache#revalidating-components-with-cache-tags so `fetchOptions: {cache: 'no-store'}` will allow for overriding this behavior with the parameters on the http() transport from viem.
1 reply
1 recast
1 reaction