SOLVED: VS Code Webview Service Worker Error in Firebase/Google Cloud Workstations - Kaspersky Antivirus Issue

I am writing this article for people who are like me, beginners and non-tech experts, so I am highlighting the steps that worked for me after struggling with it for some time. When the webview stopped working for me, I was upset, so what you see below is a collection of what I have found:

Problem Description

When using Firebase Studio or Google Cloud Workstations with VS Code in the browser, you may encounter this error:

```

Error loading webview: Error: Could not register service worker: SecurityError:

Failed to register a ServiceWorker: The provided scriptURL

(‘https://…cloudworkstations.googleusercontent.com/…/service-worker.js’)

violates the Content Security Policy.

```

Note: You might not face this issue when you first start your project, even while having your anti-virus active. For me, it started after a week or so

Root Cause

Kaspersky antivirus (version 2025) blocks service worker registration in Cloud Workstations due to:

  • SSL/HTTPS traffic interception
  • Content Security Policy header injection
  • Script injection into web traffic
  • Encrypted connection scanning

Solution

If you have Kaspersky Standard, Plus, Premium, or Small Office Security installed, follow these steps:

For me I was using Premium

Step 1: Configure Addresses to be Trusted

  1. Open Kaspersky → Click Settings icon (gear)
  2. Go to Security settings
  3. Click Network Settings
  4. Click Configure Trusted Addresses
  5. Click Add and enter each of these domains:
    1. `*.cloudworkstations.googleusercontent.com`
    2. `*.cloudworkstations.dev`
    3. `*.firebaseapp.com`
    4. `*.firebase.com`
  6. Click OKSave

Step 2: Restart Browser

  1. Completely close your browser (all tabs and windows)
  2. Clear browser cache (optional but recommended)
  3. Reopen your Cloud Workstation

Verification

After completing these steps, the service worker error should be resolved, and VS Code extensions/webviews should load normally in your Cloud Workstation.

Alternative Quick Test

To confirm Kaspersky is causing the issue:

  • Temporarily pause Kaspersky protection (5 minutes)
  • Reload your Cloud Workstation
  • If the error disappears, Kaspersky is confirmed as the cause
  • Re-enable protection and apply the exclusions above

Additional Notes

  • This issue affects other cloud development environments too (GitHub Codespaces, Gitpod, etc.)
  • Do not disable your antivirus completely - use exclusions instead
  • The wildcard `*` ensures all subdomains are covered
  • Kaspersky’s SSL certificate interception breaks WebSocket connections required by Cloud Workstations

Related Issues

This solution could also fix the following:

  • Extension installation failures
  • WebSocket connection error

Tested with:

  • Kaspersky Standard/Plus/Premium 2025
  • Google Cloud Workstations
  • Firebase Studio
  • Chrome

Hope this helps others experiencing the same issue!

And if there was any mistake in my post, let me know, please

I see this kind of stall a lot when dev environments are misaligned or dependencies break mid-boot. Here’s a tactical checklist to un-stick your project:

:wrench: Stall Diagnosis & Recovery Steps

  1. Clear .firebase, node_modules, and .cache
    Sometimes leftover state corrupts startup.

    rm -rf node_modules .firebase .cache
    npm install
    
    
  2. Check local .firebaserc & firebase.json
    Corrupted or conflicting config can block startup.
    Ensure your project alias matches and hosting / functions entries are valid.

  3. Run in verbose / debug mode

    firebase serve --debug
    
    

    Inspect logs for missing dependencies, port conflicts, or permission errors.

  4. Check for locked ports
    Another process may be occupying the port (e.g. 5000, 9000).
    Use lsof -i :5000 or Windows equivalent to see if it’s blocked.

  5. Validate your SDK versions
    Incompatibility between Firebase tools, Node.js versions, and the project’s dependencies often break boot.
    Use the version ranges specified in your package.json.

  6. Permissions / Disk Quota
    In cloud-based dev workstations, disk usage or file permission issues can stall process spawn.
    Check quotas, read/write access to the project folder.

  7. Reinitialize environment
    As a last resort, clone a fresh copy of the repo (or branch) and re-run firebase init, re-link the project, then deploy from scratch.

:warning: Many hangs are due to hidden state or mismatch rather than actual Firebase server bugs. If you try the above and still get stuck, share the first 50 lines of your debug log (from firebase serve --debug) — I’ll help you pinpoint the root cause.

(If you want, I can send this as a neatly formatted Manual PDF you can keep for future stalls — DM me if you’d like that.)

1 Like