SharePoint / SharePoint/sp-dev-docs

SharePoint Service Worker selectively blocks custom CDN assets while other assets from same origin load fine

Open
#10,848 4 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since May 21, 2026.

area:cdn Needs: Author Feedback sharepoint-developer-support type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

None

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details

No response

Describe the bug / error

The SharePoint Service Worker (spserviceworker.js) intermittently blocks specific JavaScript assets hosted on a custom CDN, while other assets from the exact same CDN origin and path load without issue.
Disabling Service Workers entirely resolves the problem, which strongly suggests the issue lies in how the SP Service Worker intercepts and handles fetch requests.

Example:
We have two Web Parts whose resources are available in the same location on the CDN.
The first, profile_xxx_js, will be blocked, but the second, people_xxx.js, located in exactly the same place, will be allowed.
It is only after the Service Worker makes another attempt—without any user intervention—that the file will be loaded.
Image
Image

When Service Workers are disabled, the problem goes away.
When they are re-enabled, the problem reappears.
Image

Steps to reproduce
  1. Load a SharePoint page that preloads multiple JS assets from a custom CDN (same origin, same path prefix, same version).
  2. Observe that some assets load correctly (HTTP 200 via ServiceWorker) while others fail with net::ERR_FAILED or CORS error.
  3. The failing asset eventually recovers and loads via the Service Worker after several retries — without any user action.
  4. Forcing a hard refresh (Ctrl+Shift+R) does not fix the issue.
  5. Disabling Service Workers in Chrome DevTools (Application > Service Workers > Bypass for network) makes all assets load correctly every time.
  6. Re-enabling Service Workers causes the issue to reappear.
Expected behavior

All assets from the same CDN origin should be handled consistently by the Service Worker — either all intercepted or all passed through, without arbitrary failures.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.