6

The app works just fine when I run it in the Visual Studio debugger, but if I deploy it to a server I get this error in the browser console:

Failed to find a valid digest in the 'integrity' attribute for resource 'http://example.com/pwaexperiment/wwwroot/_framework/wasm/dotnet.3.2.0.js' with computed SHA-256 integrity '80L/hSwps3gjABzV78X6mehoDDgsLkm1pKpSS6fAqiE='. The resource has been blocked.

What does this error mean and how can I fix it?

4
  • 1
    How do you publish ? Is that through a proxy ? Is example.com really your domain ... Commented May 28, 2020 at 12:20
  • A Wasm app should not depend on its location. Maybe just redeploy, check the file(-size)s if you can. Make sure you overwrite. And do a Ctrl-F5 in the browser. Commented May 28, 2020 at 12:41
  • There are a number of github issues discussing this - github.com/dotnet/aspnetcore/… Commented May 28, 2020 at 13:07
  • I published by FTP. No proxy. example.com is not my domain, just wanted to redact the error message slightly. Commented May 28, 2020 at 22:45

3 Answers 3

8

Try adding the following tag to your project:

<BlazorCacheBootResources>false</BlazorCacheBootResources> 

Reference: https://github.com/dotnet/aspnetcore/issues/24505#issuecomment-684857753

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks... it helped me!!! F@# microsoft! SO many people having this problem and nobody gives clear answer..so eople will disable this feature and 90% will run unsafe code just to able to run it.
Thanks. After trying different approaches it worked :D
This solution may work, but, I'd recommend reading the potential issues that this could cause on a Production application: learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/… If you're behind a CDN, also check that it doesn't perform minification of your files, I've had this happen when using Cloudflare.
1

Your server may be compressing JS files on the fly, that changes content so integrity fails. Disable compression.

Comments

1

Try to delete the bin and obj folders in the project. Then the compiler will rebuild the blazor.boot.json file with the new hashes. And it loads and passes the hash check on the browser.

2 Comments

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
This did work for some situations and worth to give it a try.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.