Azure / Azure/static-web-apps

Blazor WASM PWA service worker unable to start

Open
#490 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
I have a Blazor WebAssembly application that is currently deployed to Azure Static Web Apps. I have setup my Blazor application as a PWA using the steps from the official Microsoft documentation.

https://docs.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-5.0&tabs=visual-studio

When I run the deployed application, the service worker fails to start as it is unable to access certain resources of my Blazor application, as specified in the service worker assets file.

When I run my application locally with IIS, the service worker starts correctly and I am able to install the application as a PWA.

**To Reproduce**
The application is deployed here: https://witty-pebble-0c280bc10-11.centralus.azurestaticapps.net/

As you can see, when you open it in Google Chrome (or another browser), the service worker fails to reach many resources such as files in my `_framework` folder, as well as the `staticwebapp.config.json` file.

The app is deployed using the default GitHub actions build file when first setting up the static web app. The only different is that I have a staticwebapp.config.json file that contains the following:

```json
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
```

**Expected behavior**
The service worker should start and my user should be prompted to install the application.

**Screenshots**
![image](https://user-images.githubusercontent.com/10014944/122860189-a4321980-d360-11eb-9c39-dbb7104d84b8.png)
![image](https://user-images.githubusercontent.com/10014944/122860221-b2803580-d360-11eb-926c-093a3ab4ddad.png)

**Device info (if applicable):**
- OS: Windows 10
- Browser: Google Chrome
- Version: 91

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.