Publishing Blazor WASM failing with Integrity checks

See original GitHub issue

Describe the bug

A newly published Blazor Webassembly .net 5 app fails to start in the browser with Integrity check failures. Have several applications which have run fine on .net5 for months. In the week of .net 6 being released they’ve started to fail when a new version is published (no idea if it’s the .net 6 release, whether it’s moving to VS2022, or they’re both a coincidence). It’s not every single time, but it’s now a common issue that has never occurred prior to w/c 8th November 2021.

Developed on Windows 10, Production systems are on Linux behind Nginx. Cleaning the build before publish doesn’t fix the problem. Manually deleting the bin and obj folders in the Client and Server Projects makes the problem go away (is probably just the Client project that needs deleting tbh).

To Reproduce

Blazor WebAssembly Self Hosted app on Windows 10, VS2022. Right click on the server project and publish. Publish to a folder, zip up and copy to the Linux server. after starting the app appears to start and then does nothing. But the browser console has the errors shown in the Exception section below. Error log also attached.

With no code changes, no csproj changes, no nuget changes, I can reliably make the problem go away by deleting the bin and obj folders in the projects, performing the steps above and the Blazor app starts.

Exceptions (if any)

app.sharperpages.com/:1 Unknown error occurred while trying to verify integrity. app.sharperpages.com/:1 Failed to find a valid digest in the ‘integrity’ attribute for resource ‘https://app.sharperpages.com/_framework/HtmlAgilityPack.dll’ with computed SHA-256 integrity ‘OwW+oeVwPiItyx8Oy+kaasZrJOndOzmKFF6WSddzFFI=’. The resource has been blocked. app.sharperpages.com/:1 Unknown error occurred while trying to verify integrity. blazor.webassembly.js:1 Error: Failed to start platform. Reason: TypeError: Failed to fetch at blazor.webassembly.js:1 at blazor.webassembly.js:1 at Object.throw (blazor.webassembly.js:1) at s (blazor.webassembly.js:1) d.printErr @ blazor.webassembly.js:1

Further technical details

  • ASP.NET Core version:
  • The IDE (VS / VS Code/ VS4Mac) you’re running on,
  • VS Studio 2022 Community Edition on Windows 10 app.sharperpages.com-1637492813346.log and its version:
  • Include the output of dotnet --info:
dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff

Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa

.NET SDKs installed: 5.0.201 [C:\Program Files\dotnet\sdk] 6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]


Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:26 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
Laftekcommented, Mar 1, 2023

Please fix this. Its preventing to use Blazor WASM for web app.

0reactions
Laftekcommented, Mar 2, 2023

I just found out that I was getting integrity check because blazor.webassembly.js and then .dll files were rejected (403) by Edge (company laptop). This happens when I deploy to netlify. If I deploy to GH it works on my company laptop but only if I use BlazorWasmPreRendering.Build and PublishSPAforGitHubPages nuggets(this one cannot be used for netlify though).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blazor WebAssembly Application fails to load due to ...
This means that the hash of the file contents no longer matches the hash found in blazor.boot.json -> an integrity issue will be...
Read more >
Integrity Check failed Error for Published Blazor wasm ...
The best solution I have found to this issue is the delete the "obj" and "bin" folders in the Solution and rebuild the...
Read more >
Fix Blazor WebAssembly PWA integrity checks
This issue will surface when any modification is made to the files listed in the service-worker-assets.js file. The service-worker-assets.js ...
Read more >
Blazor WASM app won't load after publish. Works fine on ...
The resource has been blocked." "Unknown error occurred while trying to verify integrity." "Uncaught (in promise) TypeError: Failed to fetch. at ...
Read more >
Blazor - Failed to find a valid digest in the 'integrity' attribute
When Blazor WebAssembly downloads an app's startup files, it instructs the browser to perform integrity checks on the responses.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found