Trouble uploading Service Worker to Root folder (trying a Add to Homescreen Button)

I’m trying to add a ADD TO HOMESCREEN button on my application, and to do so I have to upload a Service Worker (service-worker.js) via Bubble Settings.

I’m using this tutorial:

However, I’m having this problem:

This happened: DOMException: Failed to register a ServiceWorker for scope (‘https://aqqua.com.br/’) with script (‘https://aqqua.com.br/service-worker.js’): The script resource is behind a redirect, which is disallowed.

The thing is, if you try and access my service-worker.js file, it will redirect you to “s3.amazonaws.com/appforest[...]/service-worker.js”.
I haven’t found a way to host this file directly at Bubble without redirecting it.

Has anyone found a way to insert a ADD TO HOMESCREEN button? So far I haven’t found a solution on this forum.
If so, how did you upload the service-worker?

Thank you!

just for info, my service worker worked until some days ago. Now, it doesnnßt work anymore, stored inside the root directory of bubble and registered from the page, the landing page. It worked before some days…I am searching what happened, and how to resolve this. As said, before I had a full PWA runnign with all points on Lighthouse Test (by Google).

You need to revert back to Version 5 of Bubble (under ‘Settings’ > ‘Versions’).

As per the Version 6 release notes from Bubble: “File requests now redirect to download directly from amazon, rather than proxying the files.”

That causes the redirect issue when attempting to access a service worker.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.