I am facing an issue when loading a site built and published using blazor. I get the following error message:
" Failed to find a valid digest in the 'integrity' attribute for resource 'https://MYWEBSITEURL.com/_framework/System.Private.CoreLib.dll' with computed SHA-256 integrity 'xV9SflNt5Ex5gP7OznQorlp2VkdJXkcAiopU+h5DRzY='. The resource has been blocked. "
I assume that the browser blocks the files from downloading because the hashes created when publishing do not match.
No files where edited after publish and no git was involved I publish the application from VS 2019 and upload to the server via FTP.
However, the pattern is random. If I refresh the page a few times, it works, and if I refresh the page again, it breaks again. Some times one resource gest blocked, other times none, and other times 10.
Any assistance would be greatly appreciated.
I have the same problem and looks like the root cause is that service-worker-assets.js with OLD hashed values is cached by the browser (at least I see in dev tools on Network tab that when new version of SW tries to download new service-worker-assets.js file it retrieved from disc cache).
See github issue with potential solution posted by @dvallmen (I've not tested yet on production)
github.com/dotnet/aspnetcore/issues/39016
Solution is to disable retrieving service-worker-assets.js from HTTP cache by registering SW with updateViaCache parameter set to 'none'
navigator.serviceWorker.register('/service-worker.js', {updateViaCache: 'none'})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With