Closed aleksi-magner closed 2 months ago
@aleksi-magner It looks like your site is currently configured to go to https://shifts-lapina.verme.ru/push/OneSignalSDKWorker.js?appId=eb3cddd0-1737-4262-b994-c4beda0a30f0&sdkVersion=160202
however it is not returning JavaScript and is instead returning some kind of HTML page. This is called out with the error "The script has an unsupported MIME type ('text/html')". in the log.
Make sure your server is correctly hosting the .js file.
@jkasten2 Yes, absolutely. If you open files using separate links in a new tab, everything will load. Moreover, if you connect version 15 in the same files, in the same places, it works correctly.
Firstly, all errors point to the OneSignal file being used - ServiceWorkerManager.js:279:12
. Secondly, Firefox also shows the error "operation insecure"
@aleksi-magner not sure which page in your site your are testing your browser with but it seems the difference might be between push/OneSignalSDKWorker.js
vs OneSignalSDKWorker.js
being accesses intead based on your OneSignal settings.
@jkasten2 I test both here and there. Initially it was necessary to replace SW in the /push/ directory. When nothing worked, I tried adding the file to the project root
It's as if the script is trying to register index.html, where the OneSignal SDK is initialized, instead of registering SW from the /push/ directory
It’s as if where there is an error about the mime type ('text/html')
in the script location search variable, the directory from the settings is missing. Looks for the path server.com/SDK.sw.js?appId=...
instead of server.com/push/SDK.sw.js?appId=...
@aleksi-magner what status do you seen in the network tab? It is showing the service worker registering for me on the network tab:
@jkasten2 First there was status 200, but content type html
Now, after many days of attempts, the worker has finally registered. Did they change anything in the SW registration? This is a test circuit, I’m worried that this is an accident and there will be problems in production
The file is hosted on your server, my best guess would be either caching on you server or the browser, but it could be something else on your server setup.
It seems like I’ve already double-checked everything, all the caches, and even tried it in new browsers. Since the SW connection was ultimately successful, then I close the current problem. Thank you for your assistance
What happened?
I can't get the Service Worker to initialize. I tried placing it both in the project root and in a separate directory. Version 15 works fine. Help me figure out what the problem might be.
At the same time, the OneSignal instance itself is seen as class nn. But it is not possible to register SW.
What browsers are you seeing the problem on?
Firefox, Chrome (Chromium)
What operating system are you running?
Linux, alpine stable version (docker image)
Steps to reproduce?
What did you expect to happen?
Successful SW registration
Relevant log output