Starting from Bubble version 6, you cannot store files straight in the root directory. Well, technically, you can upload files, but now file requests redirect to download from S3.
So service workers file that should be hosted on the root directory
As you know, it’s impossible to build full-fledged PWA w/o service workers. But sw.js file can’t be settled on a different domain than the pages it controls. And in case you’re trying to claim that sw.js hosted on your domain, the browser doesn’t register it, because it understands that file is under redirect.
Additionally, the place where sw.js hosted affects the maximum scope of the service worker’s control, and to give him access to the whole app, you need to place the sw.js file at the “top-level” (root directory).
Yeah, you still can run manifest.json from an external source, but that’s not a whole thing you need for real PWA.
So, the question is the following.
Did someone manage to get the service workers run from S3 or any other external source? Or maybe you found a method to make it work in another way on Bubble version 6 version and higher?
Well, technically, it’s not a bug itself, cuz you’re still able to upload files to yourdomain.com/filename, the only thing - that file will be under redirect. And it’s okay for many cases, but not for service workers.
I chatted with support on this matter. The only thing they can suggest for now - downgrade to v.5. Obviously, staying forever on the outdated version of Bubble doesn’t sound like an elegant solution for me.
And yeah, they are " hoping to improve this function in the future."
But you know how it works if only two users are complaining (myself and @AliFarahat ), they can put it on the back-burner, and we’ll wait for fixes for a very long time.
That’s why I’m looking for a solution to force sw.js register and install from external sources.
We have tryed different solutions for 5 days and there are none. The file must be served from the same domain and path to be considered secured.
The browser will not allow anything else and it is part of the PWA specs. We have also tried generating the file using a blob bit that wind work for two reasons. 1st it’s not a valid protocol and 2nd you can control the blobs name.
As whether it’s a bug or not? well… It is as the v5 and before have done it correctly and now it does not. A redirect basically means the file is not hosted at root.
We have invested so much time and money building our PWAs and serviceworkers the right way now it’s basically on hold till 5his bug is resolved. I can see the bug that I reported has a report attached to it but still underway…
Hope is all I have left for this fix to be pushed out soon.