Skip to content

Failed to execute 'importScripts' on 'WorkerGlobalScope' #8423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dlarocque opened this issue Aug 13, 2024 · 1 comment
Closed

Failed to execute 'importScripts' on 'WorkerGlobalScope' #8423

dlarocque opened this issue Aug 13, 2024 · 1 comment
Labels
new A new issue that hasn't be categoirzed as question, bug or feature request question

Comments

@dlarocque
Copy link
Contributor

Operating System

macOS

Browser Version

Chrome

Firebase SDK Version

10.12.5

Firebase SDK Product:

Component

Describe your project's tooling

Vanilla JS Service worker

Describe the problem

Firebase CDN scripts fail to load in service worker environments using importScripts().

sw.js:1 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://www.gstatic.com/firebasejs/10.12.5/firebase-app.js' failed to load.
    at http://localhost:50929/sw.js:1:1

This issue only exists on version 10.12.5. I tested on 10.12.4 and do not encounter the error.

Steps and code to reproduce issue

index.html:

<html>
  <head>
    <script>
      (async () => {
        await navigator.serviceWorker.register("./sw.js", { scope: "/" })
          .then((registration) => {
            console.log('Service worker registered:', registration); 
          });
      })();
    </script>
  </head>
  <body>
  </body>
</html>

sw.js:

importScripts('https://www.gstatic.com/firebasejs/10.12.5/firebase-app.js')
  1. npm install -g serve
  2. npx serve
  3. Visit URL where files are being served, and observe error message in the console.
@dlarocque dlarocque added question new A new issue that hasn't be categoirzed as question, bug or feature request labels Aug 13, 2024
@dlarocque
Copy link
Contributor Author

Oh, this seems to be the same issue as #8409, but for the non-compat package.

@firebase firebase locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new A new issue that hasn't be categoirzed as question, bug or feature request question
Projects
None yet
Development

No branches or pull requests

1 participant