I have a app in shopify platform and I'm using Script Tag to add functionlity to merchant's storefront, in script tag file I'm trying to register service worker but I got the fallowing error:
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The origin of the provided scriptURL ('https://fea3-5-219-49-37.ngrok.io') does not match the current origin ('https://pouyas-store.myshopify.com')
here is my code in embeded javascript file:
const baseURL = "https://fea3-5-219-49-37.ngrok.io";
(function (){
navigator.serviceWorker.register(baseURL+"/static/shopify_app/ServiceWorker.js")
.then((reg) => {
console.log("reg",reg);
if (Notification.permission === "granted") {
getSubscription(reg);
} else if (Notification.permission === "blocked") {
} else {
$("#GiveAccess").show();
$("#PromptForAccessBtn").click(() => requestNotificationAccess(reg));
}
});
})()