firebasenext.js13firebase-hostingnextjs-image

Firebase Hosting Next Js Cached optimized images purged on new deploy?


Does Firebase purge all Next JS generated optimized images from cache on each Deploy? I'm using Next JS image tag to generate avif and webp images, initially they take time to generate on first request but after that on subsequent requests it's fast. However I'm noticing after each new deploy the first request is taking long again(seems it's generating avif images again). Is there a way to persist the Cached Optimized images?

UPDATE: The issue seems to be worse for avif images if i render using webp images the images load quickly even after new deploys.


Solution

  • You might want to review the documentation:

    Any requested static content is automatically cached on the CDN. If you redeploy your site's content, Firebase Hosting automatically clears all your cached content across the CDN until the next request.

    If you're asking if the Firebase Hosting CDN clears its cache of content (both static and dynamic) between deployments, then answer is yes. It has no way of knowing by default if a deployment is intended to reuse any cached content.