Serverless function runs right after edge middleware is invoked, overriding built-time data

Hi all, I'm running a content focused website for my company using sanity for cms (with groqd for type-safe query building) and next-intl for i18n. Since going live I saw that the sanity api request bill is racking up even though I've set the request to sanity to be cached. Checking out the logs on vercel's dashboard. I noticed that it runs the serverless function again right after everytime the middleware cached is invoked and call the data from sanity again. This is different from what how it is in the POC project I mocked up with similar packages where only the middleware is called and there's no additional request to sanity Have anyone ran into this sort of issue? I would really appreciate the help. Thanks in advance
No description
No description
6 Replies
upio
upio6mo ago
can you send the site i want to check something
Nghĩa dev
Nghĩa devOP6mo ago
sadly, I can't. I'm under an NDA and can't disclose the site i'm working on. Can you guide me through to what you wanted to check?
upio
upio6mo ago
makes sense, go in devtools and check the network tab then reload the page is there like a continuous http request that is done?
Nghĩa dev
Nghĩa devOP6mo ago
there's an initial request that contains just html but then there's some staggered out but no continuous request I believe
No description
upio
upio6mo ago
Ok, just making sure. I would suggest logging out debug info so u can try and find where the requests originates from this also could be a issue with the config with either vercel or with the live packages
Nghĩa dev
Nghĩa devOP6mo ago
Thanks for the reply tho :blessjmg:
Want results from more Discord servers?
Add your server