Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

Subsequent identical Blazor pipeline deployment to SWA deploys broken build #1475

Open pingu2k4 opened 1 month ago

pingu2k4 commented 1 month ago

Describe the bug

Hey, We host our repo with Azure DevOps, and have a pipeline to publish our Blazor WASM application to SWA.

The pipeline has worked for us for a while, and we haven't made any changes to it. We last successfully deployed a week ago (on the 13th May). We attempted another deploy this morning, with purely just some text changes - nothing you would expect to break a build.

The pipeline runs successfully, and everything appears to be working, however our site does not deploy correctly. It hangs at the Blazor loading animation, with errors awaiting in the console.

MONO_WASM: TypeError: Cannot read properties of undefined (reading 'out')
Error in mono_download_assets: TypeError: Cannot read properties of undefined (reading 'out')
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'out')
Uncaught (in promise) Error: Failed to start platform. Reason: TypeError: Cannot read properties of undefined (reading 'out')

image

We have of course tried to deploy the last known working version, prior to the text changes, but this produces the same result.

Having looked at the output from the devops pipeline runs, the only notable difference I am able to really see is that the "workload manifest" version numbers differ - Installing workload manifest microsoft.net.workload......... version 8.0.4 - That is for the last successful run last week, whereas now it is using versions 8.0.5 for everything.

It is worth noting that the blazor project has always, and still does run perfectly fine locally, on more than 1 machine. There appears to be an issue with the deployment, I just am at a loss as to what the cause is.

To Reproduce Not really sure

This is our devops pipeline step:

steps:
  - checkout: self
    submodules: true
  - task: AzureStaticWebApp@0
    env:
      ENABLE_MULTIPLATFORM_BUILD: true
    inputs:
      azure_static_web_apps_api_token: $(SWA_TOKEN)
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
      app_location: "frontend" # App source code path
      api_location: "data" # Api source code path - optional
      output_location: "wwwroot" # Built app content directory - optional
      app_build_command: "dotnet publish -c Release"
###### End of Repository/Build Configurations ######

And our swa-cli config:

{
  "$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
  "configurations": {
    "eit.app": {
      "appLocation": "frontend",
      "outputLocation": "bin\\wwwroot",
      "appBuildCommand": "dotnet publish -c Debug -o bin",
      "run": "dotnet watch run",
      "appDevserverUrl": "http://localhost:8000",
      "dataApiLocation": "swa-db-connections"
    }
  }
}

Expected behavior Identical behaviour with identical inputs to the run - It worked a week ago, now with the same commit it doesn't.

Additional context Just one more bit to add, and that is that static content appears to be working fine. As in, I can load our css files, our images etc by accessing them directly and they are fine. The initial HTML is correct also. But it appears that the deployment has done something with the WASM related files only.

Rauce commented 1 month ago

I am seeing the exact same browser error for my Blazor WASM app. This worked fine until a few days ago. No code has been changed.

I agree with OP that it feels as if .NET 8.0.5 has broken something... not sure what though, these Blazor WASM JS source files are obfuscated.

image
pingu2k4 commented 1 month ago

Hey @Rauce - We've not managed to remedy this yet, but would be great to ask a few things...

Do you happen to be using DAB (Data Api Builder)? We have been trying to eliminate or determine this as a source of the issue this morning, but have been unsuccessful in finding anything conclusive. It went into GA recently, so in terms of timeline it would line up very well with our issues...

Rauce commented 1 month ago

@pingu2k4 Nope, ours is a deployment of a simple Blazor WASM app to an Azure K8S container via GitHub Actions + Argo CD.

Looks like others are having the same issue: https://github.com/dotnet/aspnetcore/issues/55751

pingu2k4 commented 1 month ago

Ah cheers for the info. Lets us rule that out, and thanks for the link to the other issue - Super useful.