Skip to content
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

v2 SW error: Failed to execute 'importScripts' on 'WorkerGlobalScope' #192

Closed
charlesfries opened this issue Oct 1, 2021 · 2 comments · Fixed by #193
Closed

v2 SW error: Failed to execute 'importScripts' on 'WorkerGlobalScope' #192

charlesfries opened this issue Oct 1, 2021 · 2 comments · Fixed by #193

Comments

@charlesfries
Copy link
Collaborator

Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://www.gstatic.com/firebasejs/9.0.2/firebase-app.js' failed to load.

import scripts

I'm seeing this service worker error after the ECFA v2 update.

Steps to reproduce:

ember new my-app
cd my-app

ember install ember-simple-auth firebase ember-cloud-firestore-adapter ember-service-worker

ember generate adapter application
ember generate serializer application

// add config

ember s

I believe this may have to do with ember-service-worker wrapping the contents of sw.js in a self invoking function, in which case this issue is unrelated to this addon.

DEBUG: -------------------------------
DEBUG: Ember      : 3.28.1
DEBUG: Ember Data : 3.28.3
DEBUG: -------------------------------
@charlesfries
Copy link
Collaborator Author

charlesfries commented Oct 1, 2021

Actually this could be due to how Firebase modules are imported into the SW in v9: https://firebase.google.com/docs/cloud-messaging/js/receive#setting_notification_options_in_the_service_worker

I tried swapping the importScript calls for ESM imports, but I don't understand how ember-service-worker is going to be able to resolve anything unless we 1) bundle firebase-app and firebase-auth separately in the dist and import them into the SW, or 2 ) use fully qualified URLs.

DockYard/ember-service-worker#63

@mikkopaderes
Copy link
Owner

mikkopaderes commented Oct 2, 2021

Yeah, you're right. Thanks for catching this.

What we want to happen to quickly make this work is to importScript the firebase-app-compat.js and firebase-auth-compat.js. I will quickly make that change and release a fix to get it going but as with the other goals, long term is to slowly move away from compat SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants