Deleted files are still served?

Within my build script, I’m deleting some files at the end, but those files are somehow still accessible. Is there a workaround?

Turns out Render keeps public artifacts from previous builds in the cache (which is nice).

I’ve opened a feature request to let us inspect the cache and selectively invalidate files:
https://feedback.render.com/features/p/dashboard-allow-inspecting-the-cache-and-selective-invalidation

1 Like

Hi Alec,

Thanks for working with me to resolve this issue. Sharing some more details here.

Render holds on to past assets for static sites so that clients that don’t have the latest version can continue operating properly.

In this case, files that were deleted were present in a past deploy and hence it looked like deleted files were still accessible.

1 Like

When the deleted asset represents a product no longer for sale, this can be very problematic. We definitely need more transparency and control over this feature.

1 Like

2nd this.

Very bad thing to do. Deleted is deleted.

Still a problem.

This means that a variety of site changes can never be made.

They are probably keying off the repo name so that only starting a new, differently named repo could fix it.

Unless the problem is even deeper.

I’m surprised to learn this behaviour is by design.

I thought it was a case of slow cache invalidation at first.

Hi @bfdes, we’re planning to fix this by giving you the ability to clear out these cached deleted assets with a click. In the meantime, we can clear them out for you when you run into issues.

2 Likes

I’m having the same issue and I really need to removed the cached files. I’ve even disabled the site but the whole site is still rendering. :-/

Ended up using redirects and re-enabling the site to get it to stop rendering the deleted page from the cache.

Hi @Zelda. I’m glad you found a workaround, but now there’s actually an easier way to clear out deleted assets. Just click the “Manual Deploy” dropdown and then “Clear build cache & deploy”. This will clear both your build cache and the cached deleted assets that Render holds on to as a fallback mechanism.

Awesome, thank you! Didn’t check there.

@david Clear build cache & deploy works nicely. Is there any way to invalidate cache for PR previews? We’re getting deleted files still served in previews

Hi @marojor. I think you should be able to Clear build cache & deploy on PR previews as well. Let us know if that’s not the case.

Hi @david thanks for your answer.

Indeed, clicking on the PR gets you in a page where you can do a manual deploy of the PR, and the Clear build cache & deploy is also available there.

One last question though, is there any way to set the default behavior to clear build cache & deploy for all deploys and not only perform it manually, so every automatic deploy does clean the cache?

is there any way to set the default behavior to clear build cache & deploy for all deploys and not only perform it manually, so every automatic deploy does clean the cache?

We don’t yet support this natively, but you may be able to set something up with our API endpoint for trigger deploys: Trigger a deploy. You could turn off auto-deploys on your service and instead trigger a ‘clear cache & deploy’ programmatically with the API. Other users have done things like this using GitHub actions.