Production build only shown after hard refresh

Hi there, I have an Node/React app deployed to App Platform. I am facing a problem when I deploy any changes, I am not served the new production build files. I am served files but nothing gets rendered on the page. If I open the chrome debugger, and right click on refresh to get empty cache and hard reload, my app begins rendering again. I’d guess I am being served old production assets, and they’re no longer valid? Not sure why. Anyone had this problem?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

After even further investigation, the react-clear-cache did not do the trick. Still looking for a solution to this.

For anyone who finds this, I believe I fixed it with the use of react-clear-cache to conditionally check for latest production builds. I also enabled the service worker in create react app via serviceWorker.register() in the top level index.js

on further inspection it does seem the main.[HASH].js file is not being updated. Hard reloading via clearing cache does load the correct hashed js file. Is there a way to tell App Platform to clear the cache on deploy to the client?