Report this

What is the reason for this report?

Production build only shown after hard refresh

Posted on November 15, 2020

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?



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!

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.

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?

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

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.