# Persistent storage between deployments

**URL:** <https://answers.netlify.com/t/persistent-storage-between-deployments/5212>\
**Category:** Support\
**Tags:** deployment, building\
**Created:** [November 17, 2019, 6:52pm UTC](https://answers.netlify.com/t/persistent-storage-between-deployments/5212 "2019-11-17T18:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitttttten](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bitttttten](https://answers.netlify.com/u/bitttttten)\
**Post date:** [November 17, 2019, 6:52pm UTC](https://answers.netlify.com/t/persistent-storage-between-deployments/5212/1 "2019-11-17T18:52:55Z")

</div>

Hello!

I am using Netlify to host a gatsby website that is a PWA and offline-friendly (using gatsby-plugin-offline). Whenever I update my website, a lot of the old assets are removed. Assets like JS bundles, CSS, and media. When people then come back to the website after an update, a lot of the website breaks until the service worker has updated and they have refreshed the tab. Not a great user experience.

This isn’t a Netlify problem, it can happen on any platform. Previously I solved this on other platforms by uploading my assets to something like S3 and then referencing the files from the website there. However, I wanted to keep everything inside Netlify and I can’t find the best solution for this. I just need persistent storage that I can write to, or to persist storage between builds. What is the best solution with Netlify?

Many thanks!

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [November 18, 2019, 7:07pm UTC](https://answers.netlify.com/t/persistent-storage-between-deployments/5212/2 "2019-11-18T19:07:34Z")

</div>

Yup, this is a pretty common use pattern. So common we wrote up the best practices around it:

> [@\[Support Guide\] Why do I see “Uncaught SyntaxError: Unexpected token \<” errors? How can I use chunking or versioning for my assets at Netlify?](https://answers.netlify.com/t/common-issue-why-do-i-see-uncaught-syntaxerror-unexpected-token-errors-how-can-i-use-chunking-or-versioning-for-my-assets-at-netlify/124):
>
> Last reviewed by Netlify Support on December 2022 The error Uncaught SyntaxError: Unexpected token \< is most commonly caused by your site’s code referring to an asset that is no longer available. Most commonly, this is due to a filename change in assets generated during your build. The same situation happens if you use versioned or chunked javascript where the filename changes with every deploy. Let’s look at an example: A file that was named /assets/main-123abc.js would change to /assets…

Take a look and let me know if you can adapt to that workflow. If not, I don’t have any better suggestions, but your use case could help inform our future developments around this workflow so I am asking for a reason 🙂

---

<div class="post-metadata">

**Author:** ![bitttttten](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bitttttten](https://answers.netlify.com/u/bitttttten)\
**Post date:** [February 8, 2020, 8:43pm UTC](https://answers.netlify.com/t/persistent-storage-between-deployments/5212/3 "2020-02-08T20:43:52Z")

</div>

Ahh yes, I see thanks! Some tools do not allow you to disable hashed filenames sadly. And if they did, the use-case there doesn’t help my problem since I have lazy loaded components which may get removed on the next deployment. So somebody navigating to an older page being served from cache, will try and lazy load a component, and it will fail. This is a common pattern on modal components, or for lazy loading some scripts that only happen when you click on a button but have large dependencies.

I was thinking of something like the workflow described in the Gatsby docs about Asset Prefixes ([Adding an Asset Prefix | Gatsby](https://www.gatsbyjs.org/docs/asset-prefix/)). I was imaging using Netlify as a asset server too, then I don’t have to configure AWS and Netlify, and it would be great to keep everything in Netlify 😄
