PWA and service workers on Bubble

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

domain.com/sw.js

For real would be hosted on S3

s3.amazonaws.com/.../sw.js

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?

1 Like

Are you sure that’s not a bug? After all, it says right there in your screenshot…

Hosted root files let you expose a file at yourdomain.com/filename.

I’d suggest submitting a bug report.

It is a bug, I reported 2 weeks ago and they are working on it.

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.

Hey Andrew

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.

2 Likes

hello there, is the bug reported on the public bug reports ?

Anyways, I’m interested to follow the outcome for PWA on Bubble

1 Like

Hi Ali,

Yeah, I couldn’t agree more.
Even if technically, Bubble informed us in the version message saying:


That doesn’t make it any better for people like us.

Hope we don’t have to wait months for that fix. Cuz I tried all the known methods, and nothing works for me as well.

@lucas.ar

I believe it’s up to the support team to decide whether to post it as reported bugs or not. The only thing we can do it’s reporting the bug.

I’ll post here if I get any news on my bug report.

Did they defined as a bug (meaning correcting) or more of a side effect and analysing if they are taking the time to modify ?

Hey all,

Yes it is a bug. Latest information is it will be resolved sometime next week maybe

1 Like

Anyone have an update on this? I’m just getting ready to tackle a PWA and SW but don’t need to spin my wheels if this is still an issue.
Thanks!

I am currently exploring the possibility of using this technology for the bubble. Any information on how to fix the error?

I believe the error has been fixed already