How long does it take for netlify functions to be updated globally? [Functions & CDN]

I’ve had a few customers reach out to me saying that a newly shipped feature is not working correctly.

When I VPN to Australia, and attempt to use my site, I see that the function logs have output corresponding to the previous version of those functions. So they have not been updated to the most recent version. How long does it take for the changes to propagate?

I’ve had a similar issue happen a few months back with a customer in Denmark, but I didn’t think to try and reproduce it by using a VPN. I’m guessing I had the same issue then.

1 Like

Hmm so my functions in Australia/New Zealand are still running the old code. Singapore has the new code though. I’m not sure how the zones are distributed but maybe there’s just a Netlify CDN bug/outage in the pacific area with AU/NZ?

Just to update here, this issue was somehow resolved, and I never got to the bottom of things.

The answer to “How long does it typically take” is that things go live globally pretty much as soon as the deploy is done.

To make it easier to debug things for the next time, I added this line to all of my functions


Then I changed my build command to be:

sed -i "s/INSERT_COMMIT_REF_VALUE/$COMMIT_REF/g" lambda/*.js && gatsby build

that way the value of $COMMIT_REF at build time gets embedded into my functions.

1 Like

thanks for circling back and letting us know your findings, @teakwood!

No problem, my hunch is still that something was wrong with the CDN node that services AU/NZ but I wasn’t in best position to debug. Now I’ll be ready for next time.

1 Like

Really frustrated:

Something is not right with functions. I’ve deployed numerous times, cleared cache, build, build, clear cache, build, build, etc. And this page still shows that functions were updated more than an hour ago:{my-site}/functions

1 Like

Hey @dns,
Could you please share your Netlify url so we can take a look? Sounds like maybe your functions are not being uploaded at all in your most recent deploys.

Hi jen,

However, please know that I’ve made a LOT of adjustments since last night.

First thing that made a positive change:

I had a theory that changing the file size might help, so I added a bunch of arbitrary text to the file. (Example: I made an error message into a full sentence instead of a short phrase.)

That seemed to help. Is there any check of file size performed before uploading a function to replace existing copy?

I altered the node version via the “AWS_whatever” environment variable. I’m now using node 14x in the functions environment. Does that make any difference, I wonder?

Anyway, I don’t suffer the problem today, it appears. Super frustrating though, and I can appreciate it’s also super difficult to re-create the problem to debug it or investigate root causes.

Good luck!

hmm, i’m not sure this is quite what you are asking, but you do need to re-deploy with a change in order for us to update your functions. Adding a console.log() should suffice, as it is the checksum that matters. Which is, i think, what you are also seeing?

As long as that changes (so, just deleting and adding whitespace wouldn’t be sufficient) you should see the changes show up.

Interesting. Thank you for responding, Perry.

I guess we’d all be surprised the number of changes one can make in a src file which is then emitted by netlify-lamba such that a checksum algorithm would continue to match previous versions of the file.

For example, let’s say a line of code amidst my lambda function had an expression like this:

myFunction() === true ? 'yay' : 'nay'

And let’s say we change it to:

myFunction() !== true ? 'yay' :'nay'

The meaning of the express is fundamentally changed but the checksum of the file may not be? (I’m asking. Let’s say I’m asking for a friend.)

Would something like this explain the behaviour I was experiencing?

We don’t really make the rules about what causes a checksum change, we just see it and react :slight_smile: The reason we suggest adding or changing a logline is that no optimization - not from webpack, or other bundling/minifying tools - will change a string literal; they can absolutely change just about everything else.

I’m not enough of a js expert to make a definitive statement about what would happen there - but I do know that if you don’t call “myFunction()”, I bet it is optimized away completely and not even included in your output, as an example.

Does that seem possible?

1 Like