Netlify Serverless function caching is not working as intended, In Spite of specifying max-age to be 1year

We have implemented the netlify caching for serverless function with the documentation as per

The code we have used is following

return {
        body: JSON.stringify(myData),
        statusCode: 200,
        headers: {
            "Netlify-Cdn-Cache-Control": "public, s-maxage=31536000", // Tell Netlify to cache the content up to 1 year

Issues Faced:
1. In-order to avoid the latency, we have specified the max-age to be 1year. But when second api-call is a made after 30-40mins after first call, netlify is loading fresh content which takes around 20-seconds of data fetch time.
2. When the api call is made from different browsers, the first call takes actual api-load time, i.e when i hit the api from chrome it’s taking 20seconds that’s valid, but when i hit the api from a different browser it should serve the cached content but it’s loading fresh, during it first-time in different browsers.

Example EP:

Hey @vudayappan,

I’ve responded to your question in Slack.

1 Like