4

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.

S.Michaelides
  • 87
  • 1
  • 9

2 Answers2

2

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'})
user3529134
  • 141
  • 10
0

This can happen for a lot of reasons, but one is if your ftp program is modifying the files at all during transfer. To solve this you can try a combination of:

  1. Select 'preserve timestamps of transferred files' for your ftp program.
  2. Try changing the transfer type to binary.
Jason
  • 396
  • 1
  • 3
  • 17